From: Douglas Gregor Date: Fri, 17 Jun 2011 03:41:35 +0000 (+0000) Subject: Downgrade the error complaining about presence of a storage class X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=51d7cdd4bfd11e0eeac55517419d0ebba0abb4cb;p=clang Downgrade the error complaining about presence of a storage class specifier on an explicit specialization to a warning, since neither EDG nor GCC diagnose this code as ill-formed. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133232 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td index 74f169626a..7cffa3c3b9 100644 --- a/include/clang/Basic/DiagnosticSemaKinds.td +++ b/include/clang/Basic/DiagnosticSemaKinds.td @@ -1912,7 +1912,7 @@ def err_not_class_template_specialization : Error< "parameter}0">; def err_function_specialization_in_class : Error< "cannot specialize a function %0 within class scope">; -def err_explicit_specialization_storage_class : Error< +def ext_explicit_specialization_storage_class : ExtWarn< "explicit specialization cannot have a storage class">; // C++ class template specializations and out-of-line definitions diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 4476211bc0..1d92c162a4 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -4663,7 +4663,7 @@ Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC, // specialization (14.7.3) if (SC != SC_None) { Diag(NewFD->getLocation(), - diag::err_explicit_specialization_storage_class) + diag::ext_explicit_specialization_storage_class) << FixItHint::CreateRemoval(D.getDeclSpec().getStorageClassSpecLoc()); } diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.stc/p1.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.stc/p1.cpp index 40917b8ae3..52e8ed6d99 100644 --- a/test/CXX/dcl.dcl/dcl.spec/dcl.stc/p1.cpp +++ b/test/CXX/dcl.dcl/dcl.spec/dcl.stc/p1.cpp @@ -7,13 +7,13 @@ template void f(T) {} template static void g(T) {} -template<> static void f(int); // expected-error{{explicit specialization cannot have a storage class}} +template<> static void f(int); // expected-warning{{explicit specialization cannot have a storage class}} template static void f(float); // expected-error{{explicit instantiation cannot have a storage class}} template<> void f(double); template void f(long); -template<> static void g(int); // expected-error{{explicit specialization cannot have a storage class}} +template<> static void g(int); // expected-warning{{explicit specialization cannot have a storage class}} template static void g(float); // expected-error{{explicit instantiation cannot have a storage class}} template<> void g(double);