]> granicus.if.org Git - clang/commitdiff
Revert r127206 "Detect attempts to provide a specialization of a function within
authorDaniel Dunbar <daniel@zuster.org>
Wed, 9 Mar 2011 23:24:34 +0000 (23:24 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Wed, 9 Mar 2011 23:24:34 +0000 (23:24 +0000)
a...", it appears to cause us to reject various valid codes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127373 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/DiagnosticSemaKinds.td
lib/Sema/SemaDecl.cpp
test/CXX/temp/temp.spec/temp.expl.spec/p2.cpp

index e86296037921a9c4d11d4c8bbbaa355d67de4435..982ed25103e2540e5975ec8120d2aa2c5a2d288e 100644 (file)
@@ -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<
index dab4bf7fbe36a9176f1af429c3a8bbeb189a49aa..5e3c5fe8ef22bf7aa4188d0a80ffdfbf3a388076 100644 (file)
@@ -4083,14 +4083,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))
index 229523557008ed40f793c6ee525cce89b2c843d5..1032a87def133248e6f1b5bf5e2ac2a4be603dfa 100644 (file)
@@ -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}}
-  };
-}