summaryrefslogtreecommitdiffstats
path: root/clang/test
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
commit2207ec273ab5c7eb659ba4576d54aa5aa7ccead0 (patch)
tree278fac12e3f567c7ba94d2095f33faebd66406d7 /clang/test
parenta4fb836f06807fc8056262d3e853414e73115b66 (diff)
downloadbcm5719-llvm-2207ec273ab5c7eb659ba4576d54aa5aa7ccead0.tar.gz
bcm5719-llvm-2207ec273ab5c7eb659ba4576d54aa5aa7ccead0.zip
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>. llvm-svn: 134984
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/CodeGenCXX/mangle.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/mangle.cpp b/clang/test/CodeGenCXX/mangle.cpp
index 0b3ba639afd..453b7b713ac 100644
--- a/clang/test/CodeGenCXX/mangle.cpp
+++ b/clang/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 {
OpenPOWER on IntegriCloud