1212
1313let Component = "Sema" in {
1414let CategoryName = "Semantic Issue" in {
15+ // C++11 compatibility with C++98.
16+ defm nonclass_type_friend : CXX11Compat<"non-class friend type %0 is">;
17+ defm static_data_member_in_union : CXX11Compat<"static data member %0 in union is">;
18+ defm templ_default_in_function_templ : CXX11Compat<
19+ "default template arguments for a function template are">;
20+ defm template_arg_extra_parens : CXX11Compat<
21+ "parentheses around address non-type template argument are">;
22+ defm typename_outside_of_template : CXX11Compat<"'typename' outside of a template is">;
23+
24+ // C++14 compatibility with C++11 and earlier.
25+ defm constexpr_type_definition : CXX14Compat<
26+ "type definition in a constexpr %select{function|constructor}0 is">;
27+ defm constexpr_local_var : CXX14Compat<
28+ "variable declaration in a constexpr %select{function|constructor}0 is">;
29+ defm constexpr_body_multiple_return : CXX14Compat<
30+ "multiple return statements in constexpr function is">;
31+ defm variable_template : CXX14Compat<"variable templates are">;
32+
33+ // C++17 compatibility with C++14 and earlier.
34+ defm decomp_decl : CXX17Compat<"decomposition declarations are">;
35+ defm inline_variable : CXX17Compat<"inline variables are">;
36+
37+ // C++20 compatibility with C++17 and earlier.
38+ defm decomp_decl_spec : CXX20Compat<
39+ "decomposition declaration declared "
40+ "%plural{1:'%1'|:with '%1' specifiers}0 is">;
41+ defm constexpr_local_var_no_init : CXX20Compat<
42+ "uninitialized variable in a constexpr %select{function|constructor}0 is">;
43+ defm constexpr_function_try_block : CXX20Compat<
44+ "function try block in constexpr %select{function|constructor}0 is">;
45+ defm constexpr_union_ctor_no_init : CXX20Compat<
46+ "constexpr union constructor that does not initialize any member is">;
47+ defm constexpr_ctor_missing_init : CXX20Compat<
48+ "constexpr constructor that does not initialize all members is">;
49+ defm adl_only_template_id : CXX20Compat<
50+ "use of function template name with no prior declaration in function call "
51+ "with explicit template arguments is">;
52+
53+ // C++23 compatibility with C++20 and earlier.
54+ defm constexpr_static_var : CXX23Compat<
55+ "definition of a %select{static|thread_local}1 variable "
56+ "in a constexpr %select{function|constructor}0 "
57+ "is">;
58+
59+ // C++26 compatibility with C++23 and earlier.
60+ defm decomp_decl_cond : CXX26Compat<"structured binding declaration in a condition is">;
61+
62+ // Compatibility warnings duplicated across multiple language versions.
63+ foreach std = [14, 20, 23] in {
64+ defm constexpr_body_invalid_stmt : CXXCompat<
65+ "use of this statement in a constexpr %select{function|constructor}0 is", std>;
66+ }
67+
1568def note_previous_decl : Note<"%0 declared here">;
1669def note_entity_declared_at : Note<"%0 declared here">;
1770def note_callee_decl : Note<"%0 declared here">;
@@ -523,30 +576,9 @@ def warn_modifying_shadowing_decl :
523576// C++ decomposition declarations
524577def err_decomp_decl_context : Error<
525578 "decomposition declaration not permitted in this context">;
526- def warn_cxx14_compat_decomp_decl : Warning<
527- "decomposition declarations are incompatible with "
528- "C++ standards before C++17">, DefaultIgnore, InGroup<CXXPre17Compat>;
529- def ext_decomp_decl : ExtWarn<
530- "decomposition declarations are a C++17 extension">, InGroup<CXX17>;
531- def ext_decomp_decl_cond : ExtWarn<
532- "structured binding declaration in a condition is a C++2c extenstion">,
533- InGroup<CXX26>;
534- def warn_cxx26_decomp_decl_cond : Warning<
535- "structured binding declaration in a condition is incompatible with "
536- "C++ standards before C++2c">,
537- InGroup<CXXPre26Compat>, DefaultIgnore;
538579def err_decomp_decl_spec : Error<
539580 "decomposition declaration cannot be declared "
540581 "%plural{1:'%1'|:with '%1' specifiers}0">;
541- def ext_decomp_decl_spec : ExtWarn<
542- "decomposition declaration declared "
543- "%plural{1:'%1'|:with '%1' specifiers}0 is a C++20 extension">,
544- InGroup<CXX20>;
545- def warn_cxx17_compat_decomp_decl_spec : Warning<
546- "decomposition declaration declared "
547- "%plural{1:'%1'|:with '%1' specifiers}0 "
548- "is incompatible with C++ standards before C++20">,
549- InGroup<CXXPre20Compat>, DefaultIgnore;
550582def err_decomp_decl_type : Error<
551583 "decomposition declaration cannot be declared with type %0; "
552584 "declared type must be 'auto' or reference to 'auto'">;
@@ -1695,12 +1727,6 @@ def warn_consteval_if_always_true : Warning<
16951727 "consteval if is always true in an %select{unevaluated|immediate}0 context">,
16961728 InGroup<DiagGroup<"redundant-consteval-if">>;
16971729
1698- def ext_inline_variable : ExtWarn<
1699- "inline variables are a C++17 extension">, InGroup<CXX17>;
1700- def warn_cxx14_compat_inline_variable : Warning<
1701- "inline variables are incompatible with C++ standards before C++17">,
1702- DefaultIgnore, InGroup<CXXPre17Compat>;
1703-
17041730def warn_inline_namespace_reopened_noninline : Warning<
17051731 "inline namespace reopened as a non-inline namespace">,
17061732 InGroup<InlineNamespaceReopenedNoninline>;
@@ -1716,11 +1742,6 @@ def ext_enum_friend : ExtWarn<
17161742 InGroup<DiagGroup<"friend-enum">>;
17171743def note_enum_friend : Note<
17181744 "remove 'enum%select{| struct| class}0' to befriend an enum">;
1719- def ext_nonclass_type_friend : ExtWarn<
1720- "non-class friend type %0 is a C++11 extension">, InGroup<CXX11>;
1721- def warn_cxx98_compat_nonclass_type_friend : Warning<
1722- "non-class friend type %0 is incompatible with C++98">,
1723- InGroup<CXX98Compat>, DefaultIgnore;
17241745def err_friend_is_member : Error<
17251746 "friends cannot be members of the declaring class">;
17261747def warn_cxx98_compat_friend_is_member : Warning<
@@ -2152,11 +2173,6 @@ def select_tag_type_kind : TextSubstitution<
21522173def err_static_data_member_not_allowed_in_anon_struct : Error<
21532174 "static data member %0 not allowed in anonymous "
21542175 "%sub{select_tag_type_kind}1">;
2155- def ext_static_data_member_in_union : ExtWarn<
2156- "static data member %0 in union is a C++11 extension">, InGroup<CXX11>;
2157- def warn_cxx98_compat_static_data_member_in_union : Warning<
2158- "static data member %0 in union is incompatible with C++98">,
2159- InGroup<CXX98Compat>, DefaultIgnore;
21602176def ext_union_member_of_reference_type : ExtWarn<
21612177 "union member %0 has reference type %1, which is a Microsoft extension">,
21622178 InGroup<MicrosoftUnionMemberReference>;
@@ -2904,63 +2920,17 @@ def err_constexpr_non_literal_param : Error<
29042920 "not a literal type">;
29052921def err_constexpr_body_invalid_stmt : Error<
29062922 "statement not allowed in %select{constexpr|consteval}1 %select{function|constructor}0">;
2907- def ext_constexpr_body_invalid_stmt : ExtWarn<
2908- "use of this statement in a constexpr %select{function|constructor}0 "
2909- "is a C++14 extension">, InGroup<CXX14>;
2910- def warn_cxx11_compat_constexpr_body_invalid_stmt : Warning<
2911- "use of this statement in a constexpr %select{function|constructor}0 "
2912- "is incompatible with C++ standards before C++14">,
2913- InGroup<CXXPre14Compat>, DefaultIgnore;
2914- def ext_constexpr_body_invalid_stmt_cxx20 : ExtWarn<
2915- "use of this statement in a constexpr %select{function|constructor}0 "
2916- "is a C++20 extension">, InGroup<CXX20>;
2917- def warn_cxx17_compat_constexpr_body_invalid_stmt : Warning<
2918- "use of this statement in a constexpr %select{function|constructor}0 "
2919- "is incompatible with C++ standards before C++20">,
2920- InGroup<CXXPre20Compat>, DefaultIgnore;
2921- def ext_constexpr_body_invalid_stmt_cxx23 : ExtWarn<
2922- "use of this statement in a constexpr %select{function|constructor}0 "
2923- "is a C++23 extension">, InGroup<CXX23>;
2924- def warn_cxx20_compat_constexpr_body_invalid_stmt : Warning<
2925- "use of this statement in a constexpr %select{function|constructor}0 "
2926- "is incompatible with C++ standards before C++23">,
2927- InGroup<CXXPre23Compat>, DefaultIgnore;
2928- def ext_constexpr_type_definition : ExtWarn<
2929- "type definition in a constexpr %select{function|constructor}0 "
2930- "is a C++14 extension">, InGroup<CXX14>;
2931- def warn_cxx11_compat_constexpr_type_definition : Warning<
2932- "type definition in a constexpr %select{function|constructor}0 "
2933- "is incompatible with C++ standards before C++14">,
2934- InGroup<CXXPre14Compat>, DefaultIgnore;
29352923def err_constexpr_vla : Error<
29362924 "variably-modified type %0 cannot be used in a constexpr "
29372925 "%select{function|constructor}1">;
2938- def ext_constexpr_local_var : ExtWarn<
2939- "variable declaration in a constexpr %select{function|constructor}0 "
2940- "is a C++14 extension">, InGroup<CXX14>;
2941- def warn_cxx11_compat_constexpr_local_var : Warning<
2942- "variable declaration in a constexpr %select{function|constructor}0 "
2943- "is incompatible with C++ standards before C++14">,
2944- InGroup<CXXPre14Compat>, DefaultIgnore;
2945- def ext_constexpr_static_var : ExtWarn<
2946- "definition of a %select{static|thread_local}1 variable "
2947- "in a constexpr %select{function|constructor}0 "
2948- "is a C++23 extension">, InGroup<CXX23>;
29492926def warn_cxx20_compat_constexpr_var : Warning<
2950- "definition of a %select{static variable|thread_local variable|variable "
2951- "of non-literal type}1 in a constexpr %select{function|constructor}0 "
2927+ "definition of a variable of non-literal type in a constexpr "
2928+ "%select{function|constructor}0 "
29522929 "is incompatible with C++ standards before C++23">,
29532930 InGroup<CXXPre23Compat>, DefaultIgnore;
29542931def err_constexpr_local_var_non_literal_type : Error<
29552932 "variable of non-literal type %1 cannot be defined in a constexpr "
29562933 "%select{function|constructor}0 before C++23">;
2957- def ext_constexpr_local_var_no_init : ExtWarn<
2958- "uninitialized variable in a constexpr %select{function|constructor}0 "
2959- "is a C++20 extension">, InGroup<CXX20>;
2960- def warn_cxx17_compat_constexpr_local_var_no_init : Warning<
2961- "uninitialized variable in a constexpr %select{function|constructor}0 "
2962- "is incompatible with C++ standards before C++20">,
2963- InGroup<CXXPre20Compat>, DefaultIgnore;
29642934def ext_constexpr_function_never_constant_expr : ExtWarn<
29652935 "%select{constexpr|consteval}1 %select{function|constructor}0 never produces a "
29662936 "constant expression">, InGroup<DiagGroup<"invalid-constexpr">>, DefaultError;
@@ -2982,41 +2952,11 @@ def err_constexpr_return_missing_expr : Error<
29822952def warn_cxx11_compat_constexpr_body_no_return : Warning<
29832953 "constexpr function with no return statements is incompatible with C++ "
29842954 "standards before C++14">, InGroup<CXXPre14Compat>, DefaultIgnore;
2985- def ext_constexpr_body_multiple_return : ExtWarn<
2986- "multiple return statements in constexpr function is a C++14 extension">,
2987- InGroup<CXX14>;
2988- def warn_cxx11_compat_constexpr_body_multiple_return : Warning<
2989- "multiple return statements in constexpr function "
2990- "is incompatible with C++ standards before C++14">,
2991- InGroup<CXXPre14Compat>, DefaultIgnore;
29922955def note_constexpr_body_previous_return : Note<
29932956 "previous return statement is here">;
29942957def err_ms_constexpr_cannot_be_applied : Error<
29952958 "attribute 'msvc::constexpr' cannot be applied to the %select{constexpr|consteval|virtual}0 function %1">;
29962959
2997- // C++20 function try blocks in constexpr
2998- def ext_constexpr_function_try_block_cxx20 : ExtWarn<
2999- "function try block in constexpr %select{function|constructor}0 is "
3000- "a C++20 extension">, InGroup<CXX20>;
3001- def warn_cxx17_compat_constexpr_function_try_block : Warning<
3002- "function try block in constexpr %select{function|constructor}0 is "
3003- "incompatible with C++ standards before C++20">,
3004- InGroup<CXXPre20Compat>, DefaultIgnore;
3005-
3006- def ext_constexpr_union_ctor_no_init : ExtWarn<
3007- "constexpr union constructor that does not initialize any member "
3008- "is a C++20 extension">, InGroup<CXX20>;
3009- def warn_cxx17_compat_constexpr_union_ctor_no_init : Warning<
3010- "constexpr union constructor that does not initialize any member "
3011- "is incompatible with C++ standards before C++20">,
3012- InGroup<CXXPre20Compat>, DefaultIgnore;
3013- def ext_constexpr_ctor_missing_init : ExtWarn<
3014- "constexpr constructor that does not initialize all members "
3015- "is a C++20 extension">, InGroup<CXX20>;
3016- def warn_cxx17_compat_constexpr_ctor_missing_init : Warning<
3017- "constexpr constructor that does not initialize all members "
3018- "is incompatible with C++ standards before C++20">,
3019- InGroup<CXXPre20Compat>, DefaultIgnore;
30202960def note_constexpr_ctor_missing_init : Note<
30212961 "member not initialized by constructor">;
30222962def note_non_literal_no_constexpr_ctors : Note<
@@ -5293,12 +5233,6 @@ def note_template_param_prev_default_arg_in_other_module : Note<
52935233 "previous default template argument defined in module %0">;
52945234def err_template_param_default_arg_missing : Error<
52955235 "template parameter missing a default argument">;
5296- def ext_template_parameter_default_in_function_template : ExtWarn<
5297- "default template arguments for a function template are a C++11 extension">,
5298- InGroup<CXX11>;
5299- def warn_cxx98_compat_template_parameter_default_in_function_template : Warning<
5300- "default template arguments for a function template are incompatible with C++98">,
5301- InGroup<CXX98Compat>, DefaultIgnore;
53025236def err_template_parameter_default_template_member : Error<
53035237 "cannot add a default template argument to the definition of a member of a "
53045238 "class template">;
@@ -5307,11 +5241,6 @@ def err_template_parameter_default_friend_template : Error<
53075241def err_template_template_parm_no_parms : Error<
53085242 "template template parameter must have its own template parameters">;
53095243
5310- def ext_variable_template : ExtWarn<"variable templates are a C++14 extension">,
5311- InGroup<CXX14>;
5312- def warn_cxx11_compat_variable_template : Warning<
5313- "variable templates are incompatible with C++ standards before C++14">,
5314- InGroup<CXXPre14Compat>, DefaultIgnore;
53155244def err_template_variable_noparams : Error<
53165245 "extraneous 'template<>' in declaration of variable %0">;
53175246def err_template_member : Error<"non-static data member %0 cannot be declared as a template">;
@@ -5321,15 +5250,6 @@ def err_template_member_noparams : Error<
53215250def err_template_tag_noparams : Error<
53225251 "extraneous 'template<>' in declaration of %0 %1">;
53235252
5324- def warn_cxx17_compat_adl_only_template_id : Warning<
5325- "use of function template name with no prior function template "
5326- "declaration in function call with explicit template arguments "
5327- "is incompatible with C++ standards before C++20">,
5328- InGroup<CXXPre20Compat>, DefaultIgnore;
5329- def ext_adl_only_template_id : ExtWarn<
5330- "use of function template name with no prior declaration in function call "
5331- "with explicit template arguments is a C++20 extension">, InGroup<CXX20>;
5332-
53335253def warn_unqualified_call_to_std_cast_function : Warning<
53345254 "unqualified call to '%0'">, InGroup<DiagGroup<"unqualified-std-cast-call">>;
53355255
@@ -5468,11 +5388,6 @@ def err_template_arg_not_pointer_to_member_form : Error<
54685388 "non-type template argument is not a pointer to member constant">;
54695389def err_template_arg_invalid : Error<
54705390 "non-type template argument '%0' is invalid">;
5471- def ext_template_arg_extra_parens : ExtWarn<
5472- "address non-type template argument cannot be surrounded by parentheses">;
5473- def warn_cxx98_compat_template_arg_extra_parens : Warning<
5474- "redundant parentheses surrounding address non-type template argument are "
5475- "incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
54765391def err_pointer_to_member_type : Error<
54775392 "invalid use of pointer to member type after %select{.*|->*}0">;
54785393def err_pointer_to_member_call_drops_quals : Error<
@@ -5887,11 +5802,6 @@ def err_typename_missing_template
58875802def ext_typename_missing
58885803 : ExtWarn<"missing 'typename' prior to dependent type name %0">,
58895804 InGroup<DiagGroup<"typename-missing">>;
5890- def ext_typename_outside_of_template : ExtWarn<
5891- "'typename' occurs outside of a template">, InGroup<CXX11>;
5892- def warn_cxx98_compat_typename_outside_of_template : Warning<
5893- "use of 'typename' outside of a template is incompatible with C++98">,
5894- InGroup<CXX98Compat>, DefaultIgnore;
58955805def err_typename_refers_to_using_value_decl : Error<
58965806 "typename specifier refers to a dependent using declaration for a value "
58975807 "%0 in %1">;
0 commit comments