aboutsummaryrefslogtreecommitdiff
path: root/test/CodeGenCXX/mangle.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-07-12 15:18:55 +0000
committerDouglas Gregor <dgregor@apple.com>2011-07-12 15:18:55 +0000
commitf1588660c109610e6a79c786b83b7c9bbd6ed31e (patch)
treebb583c0e0ed23ec30f771b93299e5800f1519252 /test/CodeGenCXX/mangle.cpp
parentd248619cd1a5e13bb8fb19e97e3e923d792bfea3 (diff)
Improve name mangling for instantiation-dependent types that are not
dependent. This covers an odd class of types such as int (&)[sizeof(sizeof(T() + T()))]; which involve template parameters but, because of some trick typically involving a form of expression that is never type-dependent, resolve down to a non-dependent type. Such types need to be mangled essentially as they were written in the source code (involving template parameters), rather than via their canonical type. In general, instantiation-dependent types should be mangled as they were written in the source. However, since we can't do that now without non-trivial refactoring of the AST (see the new FIXME), I've gone for this partial solution: only use the as-written-in-the-source mangling for these strange types that are instantiation-dependent but not dependent. This provides better compatibility with previous incarnations of Clang and with GCC. In the future, we'd like to get this right. Fixes <rdar://problem/9663282>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134984 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/mangle.cpp')
-rw-r--r--test/CodeGenCXX/mangle.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/CodeGenCXX/mangle.cpp b/test/CodeGenCXX/mangle.cpp
index 0b3ba639af..453b7b713a 100644
--- a/test/CodeGenCXX/mangle.cpp
+++ b/test/CodeGenCXX/mangle.cpp
@@ -825,6 +825,15 @@ namespace test34 {
// CHECK: define weak_odr void @_ZN6test342f3ILy4EEEvRAplT_Ly8E_i
template void f3<4>(int (&)[4 + sizeof(int*)]);
+
+ // Mangling for instantiation-dependent sizeof() expressions as
+ // template arguments.
+ template<unsigned> struct A { };
+
+ template<typename T> void f4(::test34::A<sizeof(sizeof(decltype(T() + T())))>) { }
+
+ // CHECK: define weak_odr void @_ZN6test342f4IiEEvNS_1AIXszstDTplcvT__EcvS2__EEEEE
+ template void f4<int>(A<sizeof(sizeof(int))>);
}
namespace test35 {