[cfe-commits] r127373 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/SemaDecl.cpp test/CXX/temp/temp.spec/temp.expl.spec/p2.cpp
Douglas Gregor
dgregor at apple.com
Fri Mar 11 08:57:33 PST 2011
Bill, please pull this patch into the 2.9 branch.
Thanks!
- Doug
On Mar 9, 2011, at 3:24 PM, Daniel Dunbar wrote:
> Author: ddunbar
> Date: Wed Mar 9 17:24:34 2011
> New Revision: 127373
>
> URL: http://llvm.org/viewvc/llvm-project?rev=127373&view=rev
> Log:
> Revert r127206 "Detect attempts to provide a specialization of a function within
> a...", it appears to cause us to reject various valid codes.
>
> Modified:
> cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
> cfe/trunk/lib/Sema/SemaDecl.cpp
> cfe/trunk/test/CXX/temp/temp.spec/temp.expl.spec/p2.cpp
>
> Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=127373&r1=127372&r2=127373&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
> +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Wed Mar 9 17:24:34 2011
> @@ -1723,8 +1723,6 @@
> 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<
>
> Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=127373&r1=127372&r2=127373&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaDecl.cpp Wed Mar 9 17:24:34 2011
> @@ -4083,14 +4083,9 @@
> 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))
>
> Modified: cfe/trunk/test/CXX/temp/temp.spec/temp.expl.spec/p2.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/temp/temp.spec/temp.expl.spec/p2.cpp?rev=127373&r1=127372&r2=127373&view=diff
> ==============================================================================
> --- cfe/trunk/test/CXX/temp/temp.spec/temp.expl.spec/p2.cpp (original)
> +++ cfe/trunk/test/CXX/temp/temp.spec/temp.expl.spec/p2.cpp Wed Mar 9 17:24:34 2011
> @@ -237,15 +237,3 @@
> 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}}
> - };
> -}
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
More information about the cfe-commits
mailing list