aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-06-17 03:41:35 +0000
committerDouglas Gregor <dgregor@apple.com>2011-06-17 03:41:35 +0000
commit51d7cdd4bfd11e0eeac55517419d0ebba0abb4cb (patch)
tree77909022263de65e4ef90926111c615c90115201
parente3e07a5b3490bc2977859d56bac211afac2236fb (diff)
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
-rw-r--r--include/clang/Basic/DiagnosticSemaKinds.td2
-rw-r--r--lib/Sema/SemaDecl.cpp2
-rw-r--r--test/CXX/dcl.dcl/dcl.spec/dcl.stc/p1.cpp4
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);