diff options
author | David Majnemer <david.majnemer@gmail.com> | 2015-03-11 06:45:39 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2015-03-11 06:45:39 +0000 |
commit | f9bde287e86551c90202c3fa3893d5db313dfbc1 (patch) | |
tree | 476dd493eaa2d860fefbc10148d44f29aadbadc1 /clang/test | |
parent | 92e701b16f42c89b4a43319469b53b5518861f7d (diff) | |
download | bcm5719-llvm-f9bde287e86551c90202c3fa3893d5db313dfbc1.tar.gz bcm5719-llvm-f9bde287e86551c90202c3fa3893d5db313dfbc1.zip |
Sema: Properly track mangling number/name for linkage for using decls
Using declarations which are aliases to struct types have their name
used as the struct type's name for linkage purposes. Otherwise, make
sure to give an anonymous struct defined inside a using declaration a
mangling number to disambiguate it from other anonymous structs in the
same context.
This fixes PR22809.
llvm-svn: 231909
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/CodeGenCXX/mangle.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/mangle.cpp b/clang/test/CodeGenCXX/mangle.cpp index 34f091d0369..5012c3b3798 100644 --- a/clang/test/CodeGenCXX/mangle.cpp +++ b/clang/test/CodeGenCXX/mangle.cpp @@ -1071,3 +1071,33 @@ auto f4(T... x) -> decltype(operator+(x...)); // CHECK-LABEL: @_ZN6test522f4IJNS_1XEEEEDTclonplspfp_EEDpT_ void use() { f4(X{}); } } + +namespace test53 { +struct c { + using t1 = struct { int z; }; + using t2 = struct { double z; }; + using t3 = struct { float z; }; + using t4 = struct { float z; }; + + __attribute__((used)) c(t1) {} + __attribute__((used)) c(t2) {} + __attribute__((used)) c(t3) {} + __attribute__((used)) c(t4) {} + // CHECK-LABEL: @_ZN6test531cC2ENS0_2t1E + // CHECK-LABEL: @_ZN6test531cC2ENS0_2t2E + // CHECK-LABEL: @_ZN6test531cC2ENS0_2t3E + // CHECK-LABEL: @_ZN6test531cC2ENS0_2t4E +}; +} + +namespace test54 { +struct c { + using t1 = struct { int z; } *; + using t2 = struct { double z; } *; + + __attribute__((used)) c(t1) {} + __attribute__((used)) c(t2) {} + // CHECK-LABEL: @_ZN6test541cC2EPNS0_Ut_E + // CHECK-LABEL: @_ZN6test541cC2EPNS0_Ut0_E +}; +} |