From 2207ec273ab5c7eb659ba4576d54aa5aa7ccead0 Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Tue, 12 Jul 2011 15:18:55 +0000 Subject: 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 . llvm-svn: 134984 --- clang/test/CodeGenCXX/mangle.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'clang/test/CodeGenCXX/mangle.cpp') 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 struct A { }; + + template void f4(::test34::A) { } + + // CHECK: define weak_odr void @_ZN6test342f4IiEEvNS_1AIXszstDTplcvT__EcvS2__EEEEE + template void f4(A); } namespace test35 { -- cgit v1.2.3