[PATCH] D122820: [GH54588]Fix ItaniumMangler for NTTP unnamed unions w/ unnamed structs
    John McCall via Phabricator via cfe-commits 
    cfe-commits at lists.llvm.org
       
    Thu Mar 31 12:08:54 PDT 2022
    
    
  
rjmccall added a comment.
Unfortunately, this initialization case does allow a situation where
================
Comment at: clang/lib/AST/ItaniumMangle.cpp:5561
+  // field represents an anonymous record type.
+  const CXXRecordDecl *RD = FD->getType()->getAsCXXRecordDecl();
+
----------------
Alas, bit-fields are also allowed to be anonymous.
================
Comment at: clang/lib/AST/ItaniumMangle.cpp:5576
+      "program to refer to the anonymous union, and there is therefore no need "
+      "to mangle its name. '");
+}
----------------
Unfortunately, I think class value mangling has a counter-example to this: you can have an anonymous struct or union which doesn't declare any named members but will of course nonetheless show up in the list of members in the enclosing class.  Code can even give it a non-zero initializer using list-initialization; that value can never be read, but it's there, and presumably it's part of uniquely determining a different template argument value and therefore needs to be mangled.
I don't know what we should do about this in the ABI, but we shouldn't crash in the compiler.
CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122820/new/
https://reviews.llvm.org/D122820
    
    
More information about the cfe-commits
mailing list