12
12
13
13
let Component = "Sema" in {
14
14
let 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
+
15
68
def note_previous_decl : Note<"%0 declared here">;
16
69
def note_entity_declared_at : Note<"%0 declared here">;
17
70
def note_callee_decl : Note<"%0 declared here">;
@@ -523,30 +576,9 @@ def warn_modifying_shadowing_decl :
523
576
// C++ decomposition declarations
524
577
def err_decomp_decl_context : Error<
525
578
"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;
538
579
def err_decomp_decl_spec : Error<
539
580
"decomposition declaration cannot be declared "
540
581
"%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;
550
582
def err_decomp_decl_type : Error<
551
583
"decomposition declaration cannot be declared with type %0; "
552
584
"declared type must be 'auto' or reference to 'auto'">;
@@ -1695,12 +1727,6 @@ def warn_consteval_if_always_true : Warning<
1695
1727
"consteval if is always true in an %select{unevaluated|immediate}0 context">,
1696
1728
InGroup<DiagGroup<"redundant-consteval-if">>;
1697
1729
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
-
1704
1730
def warn_inline_namespace_reopened_noninline : Warning<
1705
1731
"inline namespace reopened as a non-inline namespace">,
1706
1732
InGroup<InlineNamespaceReopenedNoninline>;
@@ -1716,11 +1742,6 @@ def ext_enum_friend : ExtWarn<
1716
1742
InGroup<DiagGroup<"friend-enum">>;
1717
1743
def note_enum_friend : Note<
1718
1744
"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;
1724
1745
def err_friend_is_member : Error<
1725
1746
"friends cannot be members of the declaring class">;
1726
1747
def warn_cxx98_compat_friend_is_member : Warning<
@@ -2152,11 +2173,6 @@ def select_tag_type_kind : TextSubstitution<
2152
2173
def err_static_data_member_not_allowed_in_anon_struct : Error<
2153
2174
"static data member %0 not allowed in anonymous "
2154
2175
"%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;
2160
2176
def ext_union_member_of_reference_type : ExtWarn<
2161
2177
"union member %0 has reference type %1, which is a Microsoft extension">,
2162
2178
InGroup<MicrosoftUnionMemberReference>;
@@ -2904,63 +2920,17 @@ def err_constexpr_non_literal_param : Error<
2904
2920
"not a literal type">;
2905
2921
def err_constexpr_body_invalid_stmt : Error<
2906
2922
"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;
2935
2923
def err_constexpr_vla : Error<
2936
2924
"variably-modified type %0 cannot be used in a constexpr "
2937
2925
"%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>;
2949
2926
def 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 "
2952
2929
"is incompatible with C++ standards before C++23">,
2953
2930
InGroup<CXXPre23Compat>, DefaultIgnore;
2954
2931
def err_constexpr_local_var_non_literal_type : Error<
2955
2932
"variable of non-literal type %1 cannot be defined in a constexpr "
2956
2933
"%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;
2964
2934
def ext_constexpr_function_never_constant_expr : ExtWarn<
2965
2935
"%select{constexpr|consteval}1 %select{function|constructor}0 never produces a "
2966
2936
"constant expression">, InGroup<DiagGroup<"invalid-constexpr">>, DefaultError;
@@ -2982,41 +2952,11 @@ def err_constexpr_return_missing_expr : Error<
2982
2952
def warn_cxx11_compat_constexpr_body_no_return : Warning<
2983
2953
"constexpr function with no return statements is incompatible with C++ "
2984
2954
"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;
2992
2955
def note_constexpr_body_previous_return : Note<
2993
2956
"previous return statement is here">;
2994
2957
def err_ms_constexpr_cannot_be_applied : Error<
2995
2958
"attribute 'msvc::constexpr' cannot be applied to the %select{constexpr|consteval|virtual}0 function %1">;
2996
2959
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;
3020
2960
def note_constexpr_ctor_missing_init : Note<
3021
2961
"member not initialized by constructor">;
3022
2962
def note_non_literal_no_constexpr_ctors : Note<
@@ -5293,12 +5233,6 @@ def note_template_param_prev_default_arg_in_other_module : Note<
5293
5233
"previous default template argument defined in module %0">;
5294
5234
def err_template_param_default_arg_missing : Error<
5295
5235
"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;
5302
5236
def err_template_parameter_default_template_member : Error<
5303
5237
"cannot add a default template argument to the definition of a member of a "
5304
5238
"class template">;
@@ -5307,11 +5241,6 @@ def err_template_parameter_default_friend_template : Error<
5307
5241
def err_template_template_parm_no_parms : Error<
5308
5242
"template template parameter must have its own template parameters">;
5309
5243
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;
5315
5244
def err_template_variable_noparams : Error<
5316
5245
"extraneous 'template<>' in declaration of variable %0">;
5317
5246
def 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<
5321
5250
def err_template_tag_noparams : Error<
5322
5251
"extraneous 'template<>' in declaration of %0 %1">;
5323
5252
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
-
5333
5253
def warn_unqualified_call_to_std_cast_function : Warning<
5334
5254
"unqualified call to '%0'">, InGroup<DiagGroup<"unqualified-std-cast-call">>;
5335
5255
@@ -5468,11 +5388,6 @@ def err_template_arg_not_pointer_to_member_form : Error<
5468
5388
"non-type template argument is not a pointer to member constant">;
5469
5389
def err_template_arg_invalid : Error<
5470
5390
"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;
5476
5391
def err_pointer_to_member_type : Error<
5477
5392
"invalid use of pointer to member type after %select{.*|->*}0">;
5478
5393
def err_pointer_to_member_call_drops_quals : Error<
@@ -5887,11 +5802,6 @@ def err_typename_missing_template
5887
5802
def ext_typename_missing
5888
5803
: ExtWarn<"missing 'typename' prior to dependent type name %0">,
5889
5804
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;
5895
5805
def err_typename_refers_to_using_value_decl : Error<
5896
5806
"typename specifier refers to a dependent using declaration for a value "
5897
5807
"%0 in %1">;
0 commit comments