]> granicus.if.org Git - clang/commitdiff
[ms-cxxabi] Mangle function pointer template arguments correctly
authorReid Kleckner <reid@kleckner.net>
Wed, 20 Mar 2013 22:29:42 +0000 (22:29 +0000)
committerReid Kleckner <reid@kleckner.net>
Wed, 20 Mar 2013 22:29:42 +0000 (22:29 +0000)
Reviewers: rjmccall

CC: timurrrr, llvm-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D554

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177589 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/MicrosoftMangle.cpp
test/CodeGenCXX/mangle-ms-templates.cpp

index 81a138949bf791bc6d84a986ea09c26ea832aa72..918e5d45cedf1f43a978ffd293b79059791d4551 100644 (file)
@@ -827,6 +827,9 @@ MicrosoftCXXNameMangler::mangleTemplateArgs(const TemplateDecl *TD,
     case TemplateArgument::Type:
       mangleType(TA.getAsType(), SourceRange());
       break;
+    case TemplateArgument::Declaration:
+      mangle(cast<NamedDecl>(TA.getAsDecl()), "$1?");
+      break;
     case TemplateArgument::Integral:
       mangleIntegerLiteral(TA.getAsIntegral(),
                            TA.getIntegralType()->isBooleanType());
@@ -836,7 +839,6 @@ MicrosoftCXXNameMangler::mangleTemplateArgs(const TemplateDecl *TD,
       break;
     case TemplateArgument::Template:
     case TemplateArgument::TemplateExpansion:
-    case TemplateArgument::Declaration:
     case TemplateArgument::NullPtr:
     case TemplateArgument::Pack: {
       // Issue a diagnostic.
index e16fe936bc2ec991fc79b7d89bddc21d5e35b12a..d0e8af48884a20dfe571d8383c61b9dda56304c5 100644 (file)
@@ -78,3 +78,16 @@ namespace space {
 void use() {
   space::foo(42);
 }
+
+// PR13455
+typedef void (*FunctionPointer)(void);
+
+template <FunctionPointer function>
+void FunctionPointerTemplate() {
+  function();
+}
+
+void spam() {
+  FunctionPointerTemplate<spam>();
+// CHECK: "\01??$FunctionPointerTemplate@$1?spam@@YAXXZ@@YAXXZ"
+}