lukasza added inline comments.

================
Comment at: clang/lib/Sema/SemaDeclCXX.cpp:10299
 
   if (!HasNonDeletedCopyOrMoveConstructor()) {
     PrintDiagAndRemoveAttr(0);
----------------
I tried to change this condition to `!RD.isAnonymousStructOrUnion() && 
!HasNonDeletedCopyOrMoveConstructor()` but it seems that at this point 
`isAnonymousStructOrUnion` doesn't yet work because `setAnonymousStructOrUnion` 
is called at a later point.


================
Comment at: clang/lib/Sema/SemaDeclCXX.cpp:10350
   }
 }
 
----------------
Alternative fix I've considered:
1.1. `setHasTrivialSpecialMemberForCall` for anonymous unions *if* their 
`DeclContext` is trivial.
1.2. Don't check `!HasNonDeletedCopyOrMoveConstructor()` for anonymous unions.

I don't know how to do 1.1 - this seems like a chicken-and-egg problem.  We 
can't know if `DeclContext` is trivial until we check 
`checkIllFormedTrivialABIStruct`, but when `checkIllFormedTrivialABIStruct` 
checks fields it requires that the triviality of the anonymous union is already 
known.

I don't know how to do 1.2 - changing the condition above to 
`!RD.isAnonymousStructOrUnion() && !HasNonDeletedCopyOrMoveConstructor()` 
doesn't work because at that point `isAnonymousStructOrUnion` doesn't yet work 
because `setAnonymousStructOrUnion` is called at a later point.




Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D155895/new/

https://reviews.llvm.org/D155895

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
  • [PATCH] D155895: ... Łukasz Anforowicz via Phabricator via cfe-commits

Reply via email to