aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2011-03-16 19:54:48 +0000
committerBill Wendling <isanbard@gmail.com>2011-03-16 19:54:48 +0000
commit26709e443adcb751a6c06d2ed277639c15dfe9f0 (patch)
treee7e70d0b55571484e39e38ac4c2b301c3191675d
parent8b05d478a8769b3b47ffe06590147cef1caa2a3f (diff)
downloadllvm-26709e443adcb751a6c06d2ed277639c15dfe9f0.zip
llvm-26709e443adcb751a6c06d2ed277639c15dfe9f0.tar.gz
llvm-26709e443adcb751a6c06d2ed277639c15dfe9f0.tar.bz2
--- Merging r127373 into '.':
U test/CXX/temp/temp.spec/temp.expl.spec/p2.cpp U include/clang/Basic/DiagnosticSemaKinds.td U lib/Sema/SemaDecl.cpp llvm-svn: 127751
-rw-r--r--clang/include/clang/Basic/DiagnosticSemaKinds.td2
-rw-r--r--clang/lib/Sema/SemaDecl.cpp11
-rw-r--r--clang/test/CXX/temp/temp.spec/temp.expl.spec/p2.cpp12
3 files changed, 3 insertions, 22 deletions
diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index 9fbc601..ff39511 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -1723,8 +1723,6 @@ def err_template_spec_default_arg : Error<
def err_not_class_template_specialization : Error<
"cannot specialize a %select{dependent template|template template "
"parameter}0">;
-def err_function_specialization_in_class : Error<
- "cannot specialize a function %0 within class scope">;
// C++ class template specializations and out-of-line definitions
def err_template_spec_needs_header : Error<
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index c4800c0..126c5dc 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -4067,14 +4067,9 @@ Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC,
Previous))
NewFD->setInvalidDecl();
} else if (isFunctionTemplateSpecialization) {
- if (CurContext->isDependentContext() && CurContext->isRecord()) {
- Diag(NewFD->getLocation(), diag::err_function_specialization_in_class)
- << NewFD->getDeclName();
- NewFD->setInvalidDecl();
- return 0;
- } else if (CheckFunctionTemplateSpecialization(NewFD,
- (HasExplicitTemplateArgs ? &TemplateArgs : 0),
- Previous))
+ if (CheckFunctionTemplateSpecialization(NewFD,
+ (HasExplicitTemplateArgs ? &TemplateArgs : 0),
+ Previous))
NewFD->setInvalidDecl();
} else if (isExplicitSpecialization && isa<CXXMethodDecl>(NewFD)) {
if (CheckMemberSpecialization(NewFD, Previous))
diff --git a/clang/test/CXX/temp/temp.spec/temp.expl.spec/p2.cpp b/clang/test/CXX/temp/temp.spec/temp.expl.spec/p2.cpp
index 2295235..1032a87 100644
--- a/clang/test/CXX/temp/temp.spec/temp.expl.spec/p2.cpp
+++ b/clang/test/CXX/temp/temp.spec/temp.expl.spec/p2.cpp
@@ -237,15 +237,3 @@ void test_func_template(N0::X0<void *> xvp, void *vp, const void *cvp,
xvp.ft1(vp, i);
xvp.ft1(vp, u);
}
-
-namespace PR8979 {
- template<typename Z>
- struct X0 {
- template <class T, class U> class Inner;
- struct OtherInner;
- template<typename T, typename U> void f(Inner<T, U>&);
-
- typedef Inner<OtherInner, OtherInner> MyInner;
- template<> void f(MyInner&); // expected-error{{cannot specialize a function 'f' within class scope}}
- };
-}