================ @@ -5494,55 +5494,62 @@ InjectAnonymousStructOrUnionMembers(Sema &SemaRef, Scope *S, DeclContext *Owner, RecordDecl *AnonRecord, AccessSpecifier AS, StorageClass SC, SmallVectorImpl<NamedDecl *> &Chaining) { + bool Invalid = false; // Look every FieldDecl and IndirectFieldDecl with a name. for (auto *D : AnonRecord->decls()) { if ((isa<FieldDecl>(D) || isa<IndirectFieldDecl>(D)) && cast<NamedDecl>(D)->getDeclName()) { ValueDecl *VD = cast<ValueDecl>(D); - if (CheckAnonMemberRedeclaration(SemaRef, S, Owner, VD->getDeclName(), - VD->getLocation(), AnonRecord->isUnion(), - SC)) { - // C++ [class.union]p2: - // The names of the members of an anonymous union shall be - // distinct from the names of any other entity in the - // scope in which the anonymous union is declared. + // C++ [class.union]p2: + // The names of the members of an anonymous union shall be + // distinct from the names of any other entity in the + // scope in which the anonymous union is declared. + + const bool FieldInvalid = CheckAnonMemberRedeclaration( ---------------- erichkeane wrote:
```suggestion bool FieldInvalid = CheckAnonMemberRedeclaration( ``` https://github.com/llvm/llvm-project/pull/153140 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits