GCC seems to create address-of expression manglings when passing *any*

function as a template argument where a pointer to function is wanted.
Just extend the existing hack.

llvm-svn: 130084
This commit is contained in:
John McCall 2011-04-24 08:43:07 +00:00
parent 6dc0a2b467
commit 617339e692
2 changed files with 13 additions and 2 deletions

View 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);

View 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();
}
}