From: Douglas Gregor Date: Wed, 16 Jun 2010 16:26:47 +0000 (+0000) Subject: Downgrade the error when using a typedef in the nested-name-specifier X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a2dd828ce66a67bc21c3a553e2d99ca4f182d923;p=clang Downgrade the error when using a typedef in the nested-name-specifier of an explicit instantiation to an ExtWarn, since nobody else seems to diagnose this problem. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106109 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td index d64a5395bc..5d238b4e78 100644 --- a/include/clang/Basic/DiagnosticSemaKinds.td +++ b/include/clang/Basic/DiagnosticSemaKinds.td @@ -1583,10 +1583,9 @@ def note_explicit_instantiation_candidate : Note< "explicit instantiation candidate function template here %0">; def err_explicit_instantiation_inline : Error< "explicit instantiation cannot be 'inline'">; -def err_explicit_instantiation_without_qualified_id : Error< - "qualifier in explicit instantiation of %q0 requires a template-id">; -def err_explicit_instantiation_without_qualified_id_quals : Error< - "qualifier in explicit instantiation of '%0%1' requires a template-id">; +def ext_explicit_instantiation_without_qualified_id : ExtWarn< + "qualifier in explicit instantiation of %q0 requires a template-id " + "(a typedef is not permitted)">; def err_explicit_instantiation_unqualified_wrong_namespace : Error< "explicit instantiation of %q0 must occur in %1">; def warn_explicit_instantiation_unqualified_wrong_namespace_0x : Warning< diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp index f5f4853fb0..5e40bc58bb 100644 --- a/lib/Sema/SemaTemplate.cpp +++ b/lib/Sema/SemaTemplate.cpp @@ -4911,7 +4911,7 @@ Sema::ActOnExplicitInstantiation(Scope *S, // // C++98 has the same restriction, just worded differently. if (!ScopeSpecifierHasTemplateId(SS)) - Diag(TemplateLoc, diag::err_explicit_instantiation_without_qualified_id) + Diag(TemplateLoc, diag::ext_explicit_instantiation_without_qualified_id) << Record << SS.getRange(); // C++0x [temp.explicit]p2: @@ -5084,7 +5084,7 @@ Sema::DeclResult Sema::ActOnExplicitInstantiation(Scope *S, // C++98 has the same restriction, just worded differently. if (!ScopeSpecifierHasTemplateId(D.getCXXScopeSpec())) Diag(D.getIdentifierLoc(), - diag::err_explicit_instantiation_without_qualified_id) + diag::ext_explicit_instantiation_without_qualified_id) << Prev << D.getCXXScopeSpec().getRange(); // Check the scope of this explicit instantiation. @@ -5228,7 +5228,7 @@ Sema::DeclResult Sema::ActOnExplicitInstantiation(Scope *S, D.getCXXScopeSpec().isSet() && !ScopeSpecifierHasTemplateId(D.getCXXScopeSpec())) Diag(D.getIdentifierLoc(), - diag::err_explicit_instantiation_without_qualified_id) + diag::ext_explicit_instantiation_without_qualified_id) << Specialization << D.getCXXScopeSpec().getRange(); CheckExplicitInstantiationScope(*this, diff --git a/test/CXX/temp/temp.spec/temp.explicit/p2.cpp b/test/CXX/temp/temp.spec/temp.explicit/p2.cpp index 0da316cc9c..70d338b9f6 100644 --- a/test/CXX/temp/temp.spec/temp.explicit/p2.cpp +++ b/test/CXX/temp/temp.spec/temp.explicit/p2.cpp @@ -25,9 +25,9 @@ T X0::value = 17; typedef X0 XInt; -template struct XInt::Inner; // expected-error{{template-id}} -template void XInt::f(); // expected-error{{template-id}} -template int XInt::value; // expected-error{{template-id}} +template struct XInt::Inner; // expected-warning{{template-id}} +template void XInt::f(); // expected-warning{{template-id}} +template int XInt::value; // expected-warning{{template-id}} namespace N { template