]> granicus.if.org Git - clang/commitdiff
Don't crash when trying to mangle function templates.
authorAnders Carlsson <andersca@mac.com>
Sat, 26 Sep 2009 20:13:56 +0000 (20:13 +0000)
committerAnders Carlsson <andersca@mac.com>
Sat, 26 Sep 2009 20:13:56 +0000 (20:13 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82872 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/Mangle.cpp
test/CodeGenCXX/mangle.cpp

index 69e73e78c0fb28edfa6d0f57444210731f3ce216..e07c38fd11b70dacddb6665e2cdd6f2bce5e57e7 100644 (file)
@@ -335,7 +335,7 @@ void CXXNameMangler::mangleUnscopedTemplateName(const TemplateDecl *ND) {
   if (mangleSubstitution(ND))
     return;
   
-  mangleUnscopedName(ND);
+  mangleUnscopedName(ND->getTemplatedDecl());
   addSubstitution(ND);
 }
 
@@ -532,7 +532,7 @@ void CXXNameMangler::mangleTemplatePrefix(const TemplateDecl *ND) {
   // FIXME: <substitution> and <template-param>
   
   manglePrefix(ND->getDeclContext());
-  mangleUnqualifiedName(ND);
+  mangleUnqualifiedName(ND->getTemplatedDecl());
 }
 
 void
index b61f1d00df8034ce4662e17fa1172c560fa63eab..eb6267bb6e0a157035bcf75cf4421b8472c3b1b3 100644 (file)
@@ -155,3 +155,21 @@ template<typename T> struct S6 {
 template<typename T> void ft5(typename S6<T>::B) { }
 // CHECK: @_Z3ft5IiEvN2S6IT_E1BE
 template void ft5<int>(int);
+
+template<typename T> class A {};
+
+namespace NS {
+template<typename T> bool operator==(const A<T>&, const A<T>&) { return true; }
+}
+
+// FIXME: This should be _ZN2NSeqIcEEbRK1AIT_ES5_
+// CHECK: @_ZN2NSeqIcEEbRK1AIT_ES4_
+template bool NS::operator==(const ::A<char>&, const ::A<char>&);
+
+namespace std {
+template<typename T> bool operator==(const A<T>&, const A<T>&) { return true; }
+}
+
+// CHECK: @_ZSteqIcEbRK1AIT_ES4_
+template bool std::operator==(const ::A<char>&, const ::A<char>&);
+