[PATCH] D146386: [MS ABI] Fix mangling references to declarations.
Eli Friedman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Mar 26 14:30:58 PDT 2023
efriedma added a comment.
> I don't still understand how to mangle nested unnamed tags in general.
According to some quick experiments, for the non-virtual case, you mangle a member of an unnamed union it the same way as a regular member, except you stick `<unnamed-tag>@` into the mangling. Additional levels of nesting append 3's: `<unnamed-tag>@3`, `<unnamed-tag>@33`, etc.
----
The mangling with virtual inheritance seems pretty broken. The following produces a name collision on MSVC:
#pragma pointers_to_members(full_generality, virtual_inheritance)
struct Nested { int a; union { int k; int k2;}; };
struct DerivedVirtually : Nested { int a; };
struct D2 { int DerivedVirtually::*p; };
template<D2> void f() {}
template void f<D2{&Nested::k}>();
template void f<D2{&Nested::k2}>();
The following crashes MSVC:
struct A {};
struct Nested { int a; };
struct DerivedVirtually : virtual A, Nested { };
struct D2 { int DerivedVirtually::*p; };
template<D2> void f() {}
template void f<D2{&Nested::a}>();
================
Comment at: clang/lib/AST/MicrosoftMangle.cpp:1247
+ unsigned DiagID = Diags.getCustomDiagID(
+ DiagnosticsEngine::Error, "cannot mangle anonymous struct/union yet");
+ Diags.Report(DiagID);
----------------
maybe say "anonymous struct/union member pointer", if you don't implement this.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D146386/new/
https://reviews.llvm.org/D146386
More information about the cfe-commits
mailing list