Index: clang/lib/Parse/ParseDecl.cpp =================================================================== --- clang/lib/Parse/ParseDecl.cpp +++ clang/lib/Parse/ParseDecl.cpp @@ -6205,6 +6205,11 @@ // is exited (and the declarator has been parsed). DeclScopeObj.EnterDeclaratorScope(); } + if (D.hasName() && !D.getIdentifier()) + Diag(getMissingDeclaratorIdLoc(D, Tok.getLocation()), + diag::err_expected_member_name_or_semi) + << (D.getDeclSpec().isEmpty() ? SourceRange() + : D.getDeclSpec().getSourceRange()); } else if (D.mayOmitIdentifier()) { // This could be something simple like "int" (in which case the declarator // portion is empty), if an abstract-declarator is allowed. Index: clang/lib/Sema/SemaDeclCXX.cpp =================================================================== --- clang/lib/Sema/SemaDeclCXX.cpp +++ clang/lib/Sema/SemaDeclCXX.cpp @@ -15440,6 +15440,11 @@ break; } } + if (LLVM_UNLIKELY(!Pattern)) + for (const auto *FD : ClassPattern->fields()) + if (Diags.hasErrorOccurred() && !FD->getIdentifier()) { + return ExprError(); + } assert(Pattern && "We must have set the Pattern!"); if (!Pattern->hasInClassInitializer() ||