[cfe-commits] r133232 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/SemaDecl.cpp test/CXX/dcl.dcl/dcl.spec/dcl.stc/p1.cpp

Douglas Gregor dgregor at apple.com
Thu Jun 16 20:41:35 PDT 2011


Author: dgregor
Date: Thu Jun 16 22:41:35 2011
New Revision: 133232

URL: http://llvm.org/viewvc/llvm-project?rev=133232&view=rev
Log:
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.

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

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=133232&r1=133231&r2=133232&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Thu Jun 16 22:41:35 2011
@@ -1912,7 +1912,7 @@
   "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

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=133232&r1=133231&r2=133232&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Thu Jun 16 22:41:35 2011
@@ -4663,7 +4663,7 @@
       //   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());
       }
       

Modified: cfe/trunk/test/CXX/dcl.dcl/dcl.spec/dcl.stc/p1.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/dcl.dcl/dcl.spec/dcl.stc/p1.cpp?rev=133232&r1=133231&r2=133232&view=diff
==============================================================================
--- cfe/trunk/test/CXX/dcl.dcl/dcl.spec/dcl.stc/p1.cpp (original)
+++ cfe/trunk/test/CXX/dcl.dcl/dcl.spec/dcl.stc/p1.cpp Thu Jun 16 22:41:35 2011
@@ -7,13 +7,13 @@
 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);





More information about the cfe-commits mailing list