]> granicus.if.org Git - clang/commitdiff
GCC seems to create address-of expression manglings when passing *any*
authorJohn McCall <rjmccall@apple.com>
Sun, 24 Apr 2011 08:43:07 +0000 (08:43 +0000)
committerJohn McCall <rjmccall@apple.com>
Sun, 24 Apr 2011 08:43:07 +0000 (08:43 +0000)
function as a template argument where a pointer to function is wanted.
Just extend the existing hack.

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

lib/AST/ItaniumMangle.cpp
test/CodeGenCXX/mangle.cpp

index 57e955de8685732368a0a5222f83e479e2a737aa..a32b0ef7512eed2f719c46dc5f3e7a6144c2b045 100644 (file)
@@ -2458,8 +2458,7 @@ void CXXNameMangler::mangleTemplateArg(const NamedDecl *P,
     // an expression. We compensate for it here to produce the correct mangling.
     NamedDecl *D = cast<NamedDecl>(A.getAsDecl());
     const NonTypeTemplateParmDecl *Parameter = cast<NonTypeTemplateParmDecl>(P);
-    bool compensateMangling = D->isCXXClassMember() &&
-      !Parameter->getType()->isReferenceType();
+    bool compensateMangling = !Parameter->getType()->isReferenceType();
     if (compensateMangling) {
       Out << 'X';
       mangleOperatorName(OO_Amp, 1);
index 2e1229c2ccc56d0050b9d37414814a97b22ee8c6..05cc5587e1d8657b13edea5dcc689dd032f96211 100644 (file)
@@ -664,3 +664,15 @@ namespace test24 {
     foo();
   }
 }
+
+// rdar://problem/8806641
+namespace test25 {
+  template <void (*fn)()> struct A {
+    static void call() { fn(); }
+  };
+  void foo();
+  void test() {
+    // CHECK: call void @_ZN6test251AIXadL_ZNS_3fooEvEEE4callEv()
+    A<foo>::call();
+  }
+}