]> granicus.if.org Git - clang/commitdiff
Downgrade the error complaining about presence of a storage class
authorDouglas Gregor <dgregor@apple.com>
Fri, 17 Jun 2011 03:41:35 +0000 (03:41 +0000)
committerDouglas Gregor <dgregor@apple.com>
Fri, 17 Jun 2011 03:41:35 +0000 (03:41 +0000)
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

include/clang/Basic/DiagnosticSemaKinds.td
lib/Sema/SemaDecl.cpp
test/CXX/dcl.dcl/dcl.spec/dcl.stc/p1.cpp

index 74f169626a22f6edf32178c3c06ba94dc2152135..7cffa3c3b90625a4c75330403f903892cbef5d9a 100644 (file)
@@ -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
index 4476211bc0d6a83058d31c74a799f2442b3afc53..1d92c162a4ec7a1206e1b7e4805975bf2a072f50 100644 (file)
@@ -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());
       }
       
index 40917b8ae3dc2ccfbdf7a5a10d9937c78140ad7c..52e8ed6d99a905225c3e8dc93eb0b2d9dad4ff3b 100644 (file)
@@ -7,13 +7,13 @@ template<typename T> void f(T) {}
 template<typename T> static void g(T) {}
 
 
-template<> static void f<int>(int); // expected-error{{explicit specialization cannot have a storage class}}
+template<> static void f<int>(int); // expected-warning{{explicit specialization cannot have a storage class}}
 template static void f<float>(float); // expected-error{{explicit instantiation cannot have a storage class}}
 
 template<> void f<double>(double);
 template void f<long>(long);
 
-template<> static void g<int>(int); // expected-error{{explicit specialization cannot have a storage class}}
+template<> static void g<int>(int); // expected-warning{{explicit specialization cannot have a storage class}}
 template static void g<float>(float); // expected-error{{explicit instantiation cannot have a storage class}}
 
 template<> void g<double>(double);