From 8fdd0e8cd6dbff73584b8cd5910a0e3cc1e31694 Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Wed, 24 Mar 2010 17:31:23 +0000 Subject: Silently drop dependent friend function template specializations, since we have absolutely no way to match them when they are declared nor do we have a way to represent these parsed-but-not-checked friend declarations. llvm-svn: 99407 --- clang/lib/Sema/SemaDecl.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'clang/lib') diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index e802018c9f8..e4c930e2f85 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -3130,10 +3130,17 @@ Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC, } if (isFunctionTemplateSpecialization) { - if (CheckFunctionTemplateSpecialization(NewFD, - (HasExplicitTemplateArgs ? &TemplateArgs : 0), - Previous)) - NewFD->setInvalidDecl(); + if (isFriend && NewFD->getType()->isDependentType()) { + // FIXME: When we see a friend of a function template + // specialization with a dependent type, we can't match it now; + // for now, we just drop it, until we have a reasonable way to + // represent the parsed-but-not-matched friend function template + // specialization in the AST. + return 0; + } else if (CheckFunctionTemplateSpecialization(NewFD, + (HasExplicitTemplateArgs ? &TemplateArgs : 0), + Previous)) + NewFD->setInvalidDecl(); } else if (isExplicitSpecialization && isa(NewFD) && CheckMemberSpecialization(NewFD, Previous)) NewFD->setInvalidDecl(); -- cgit v1.2.3