The attached patch is a follow up from my previous one. The existing

logic was not handling typedefs as free functions. This was not
causing problems with the existing tests, but does with the microsoft
abi where they have to get a different calling convention.

I will try to refactor this into a method on Declarator in a second.

llvm-svn: 195050
This commit is contained in:
Rafael Espindola 2013-11-18 22:40:04 +00:00
parent efb0d6bf1a
commit 4903c87386
2 changed files with 14 additions and 3 deletions

View File

@ -3240,9 +3240,11 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state,
// top-level template type arguments.
bool FreeFunction;
if (!D.getCXXScopeSpec().isSet()) {
FreeFunction = ((D.getContext() != Declarator::MemberContext &&
D.getContext() != Declarator::LambdaExprContext) ||
D.getDeclSpec().isFriendSpecified());
const DeclSpec &Spec = D.getDeclSpec();
FreeFunction = (D.getContext() != Declarator::MemberContext &&
D.getContext() != Declarator::LambdaExprContext) ||
Spec.isFriendSpecified() ||
Spec.getStorageClassSpec() == DeclSpec::SCS_typedef;
} else {
DeclContext *DC = S.computeDeclContext(D.getCXXScopeSpec());
FreeFunction = (DC && !DC->isRecord());

View File

@ -167,3 +167,12 @@ namespace test2 {
};
extern template void foo::bar(const void *);
}
namespace test3 {
struct foo {
typedef void bar();
};
bool zed(foo::bar *);
void bah() {}
void baz() { zed(bah); }
}