diff options
-rw-r--r-- | include/clang/Basic/DiagnosticSemaKinds.td | 2 | ||||
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 2 | ||||
-rw-r--r-- | test/CXX/dcl.dcl/dcl.spec/dcl.stc/p1.cpp | 4 |
3 files changed, 4 insertions, 4 deletions
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<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); |