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 | 99823a75249bb2d809f90f86a439206c474f72ee (patch) | |
tree | 19a8b2fb03df7df2e8b751d3905db307ed6b18e1 /test/CodeGenCXX/mangle.cpp | |
parent | 741be16bd5a52e8e0c08ac2149600d2ec8cf4a3a (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@231909 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/mangle.cpp')
-rw-r--r-- | test/CodeGenCXX/mangle.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/test/CodeGenCXX/mangle.cpp b/test/CodeGenCXX/mangle.cpp index 34f091d036..5012c3b379 100644 --- a/test/CodeGenCXX/mangle.cpp +++ b/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 +}; +} |