[PATCH] D146386: [MS ABI] Fix mangling references to declarations.

Andrey Ali Khan Bolshakov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Apr 1 18:32:09 PDT 2023


bolshakov-a updated this revision to Diff 510281.
bolshakov-a edited the summary of this revision.
bolshakov-a added a comment.

Mangling of anonymous unions. @eli.friedman, thank you!

> I don't know whether the aforementioned code is acceptable according to the standard, honestly.

It is not acceptable because anonymous unions cannot contain nested types. In fact, they cannot contain even other anonymous unions, according to the C++ standard:
https://timsong-cpp.github.io/cppwp/n4868/class.union.anon#1
But clang and MSVC both accept such code, probably because recursively nested anonymous structs and unions are allowed in C17. Hence, this case is handled for generality, but I'm not sure if this behavior should be nailed down in a test.


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

https://reviews.llvm.org/D146386

Files:
  clang/lib/AST/MicrosoftMangle.cpp
  clang/test/CodeGenCXX/mangle-class-nttp.cpp
  clang/test/CodeGenCXX/mangle-ms-templates.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D146386.510281.patch
Type: text/x-patch
Size: 12511 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230402/82f0e2a8/attachment.bin>


More information about the cfe-commits mailing list