diff options
author | John McCall <rjmccall@apple.com> | 2010-03-24 07:46:06 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2010-03-24 07:46:06 +0000 |
commit | 7ad650f88ecbbe659f10f9f6b34a1f29ea9cf8f9 (patch) | |
tree | 61e3a3d23e1318c3f00760c390ad5ff3f429c98d /lib/Sema/SemaDecl.cpp | |
parent | 2eef829b19bdc59976a827fa39b409440e352bff (diff) |
Support friend function specializations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99389 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index bf92ef829b..1435a8f721 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -2918,6 +2918,13 @@ Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC, } else { // This is a function template specialization. isFunctionTemplateSpecialization = true; + + // C++0x [temp.expl.spec]p20 forbids "template<> void foo(int);". + if (isFriend && isFunctionTemplateSpecialization) { + SourceRange Range = TemplateParams->getSourceRange(); + Diag(D.getIdentifierLoc(), diag::err_template_spec_decl_friend) + << Name << Range << CodeModificationHint::CreateRemoval(Range); + } } // FIXME: Free this memory properly. @@ -3101,6 +3108,9 @@ Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC, D.getDeclSpec().getSourceRange().getBegin(), "template<> "); isFunctionTemplateSpecialization = true; + } else { + // "friend void foo<>(int);" is an implicit specialization decl. + isFunctionTemplateSpecialization = true; } } |