From: Richard Smith Date: Tue, 27 Dec 2016 20:03:09 +0000 (+0000) Subject: Add warning flag for "partial specialization is not more specialized than primary... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=918a07d8657967d676cb73c087815fcd0b640f65;p=clang Add warning flag for "partial specialization is not more specialized than primary template" error (since Eigen hits it), and while I'm here also add a warning flag for "partial specialization is not usable because one or more of its parameters cannot be deduced" warning. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@290625 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td index 756f5a14d7..45ef7e3094 100644 --- a/include/clang/Basic/DiagnosticSemaKinds.td +++ b/include/clang/Basic/DiagnosticSemaKinds.td @@ -4043,14 +4043,16 @@ def err_partial_spec_args_match_primary_template : Error< "%select{class|variable}0 template partial specialization does not " "specialize any template argument; to %select{declare|define}1 the " "primary template, remove the template argument list">; -def err_partial_spec_not_more_specialized_than_primary : Error< +def ext_partial_spec_not_more_specialized_than_primary : ExtWarn< "%select{class|variable}0 template partial specialization is not " - "more specialized than the primary template">; + "more specialized than the primary template">, DefaultError, + InGroup>; def note_partial_spec_not_more_specialized_than_primary : Note<"%0">; def warn_partial_specs_not_deducible : Warning< "%select{class|variable}0 template partial specialization contains " "%select{a template parameter|template parameters}1 that cannot be " - "deduced; this partial specialization will never be used">; + "deduced; this partial specialization will never be used">, + InGroup>; def note_partial_spec_unused_parameter : Note< "non-deducible template parameter %0">; def err_partial_spec_ordering_ambiguous : Error< diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp index b335e7e260..5a3083ce3b 100644 --- a/lib/Sema/SemaTemplate.cpp +++ b/lib/Sema/SemaTemplate.cpp @@ -2637,8 +2637,8 @@ static void checkMoreSpecializedThanPrimary(Sema &S, PartialSpecDecl *Partial) { auto *Template = Partial->getSpecializedTemplate(); S.Diag(Partial->getLocation(), - diag::err_partial_spec_not_more_specialized_than_primary) - << /*variable template*/isa(Template); + diag::ext_partial_spec_not_more_specialized_than_primary) + << isa(Template); if (Info.hasSFINAEDiagnostic()) { PartialDiagnosticAt Diag = {SourceLocation(), diff --git a/test/Misc/warning-flags.c b/test/Misc/warning-flags.c index 1a33265e4c..be02e12e2c 100644 --- a/test/Misc/warning-flags.c +++ b/test/Misc/warning-flags.c @@ -18,7 +18,7 @@ This test serves two purposes: The list of warnings below should NEVER grow. It should gradually shrink to 0. -CHECK: Warnings without flags (79): +CHECK: Warnings without flags (78): CHECK-NEXT: ext_excess_initializers CHECK-NEXT: ext_excess_initializers_in_char_array_initializer CHECK-NEXT: ext_expected_semi_decl_list @@ -78,7 +78,6 @@ CHECK-NEXT: warn_not_compound_assign CHECK-NEXT: warn_objc_property_copy_missing_on_block CHECK-NEXT: warn_objc_protocol_qualifier_missing_id CHECK-NEXT: warn_on_superclass_use -CHECK-NEXT: warn_partial_specs_not_deducible CHECK-NEXT: warn_pp_convert_to_positive CHECK-NEXT: warn_pp_expr_overflow CHECK-NEXT: warn_pp_line_decimal