File tree Expand file tree Collapse file tree 4 files changed +20
-3
lines changed Expand file tree Collapse file tree 4 files changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -391,6 +391,10 @@ Improvements to Clang's diagnostics
391
391
392
392
Fixes #GH131127
393
393
394
+ - ``-Wuninitialized `` now diagnoses when a class does not declare any
395
+ constructors to initialize their non-modifiable members. The diagnostic is
396
+ not new; being controlled via a warning group is what's new. Fixes #GH41104
397
+
394
398
Improvements to Clang's time-trace
395
399
----------------------------------
396
400
Original file line number Diff line number Diff line change @@ -2266,7 +2266,8 @@ def err_constructor_byvalue_arg : Error<
2266
2266
"copy constructor must pass its first argument by reference">;
2267
2267
def warn_no_constructor_for_refconst : Warning<
2268
2268
"%select{struct|interface|union|class|enum}0 %1 does not declare any "
2269
- "constructor to initialize its non-modifiable members">;
2269
+ "constructor to initialize its non-modifiable members">,
2270
+ InGroup<Uninitialized>;
2270
2271
def note_refconst_member_not_initialized : Note<
2271
2272
"%select{const|reference}0 member %1 will never be initialized">;
2272
2273
def ext_ms_explicit_constructor_call : ExtWarn<
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ This test serves two purposes:
18
18
19
19
The list of warnings below should NEVER grow . It should gradually shrink to 0.
20
20
21
- CHECK : Warnings without flags (57 ):
21
+ CHECK : Warnings without flags (56 ):
22
22
23
23
CHECK - NEXT : ext_expected_semi_decl_list
24
24
CHECK - NEXT : ext_missing_whitespace_after_macro_name
@@ -57,7 +57,6 @@ CHECK-NEXT: warn_method_param_redefinition
57
57
CHECK - NEXT : warn_missing_case_for_condition
58
58
CHECK - NEXT : warn_missing_dependent_template_keyword
59
59
CHECK - NEXT : warn_missing_whitespace_after_macro_name
60
- CHECK - NEXT : warn_no_constructor_for_refconst
61
60
CHECK - NEXT : warn_not_compound_assign
62
61
CHECK - NEXT : warn_objc_property_copy_missing_on_block
63
62
CHECK - NEXT : warn_objc_protocol_qualifier_missing_id
Original file line number Diff line number Diff line change
1
+ // RUN: %clang_cc1 -fsyntax-only -Wuninitialized -verify %s
2
+ // RUN: %clang_cc1 -fsyntax-only -Wno-uninitialized -verify=good %s
3
+ // good-no-diagnostics
4
+
5
+ template <class T >
6
+ class RefMem { // expected-warning {{class 'RefMem<int &>' does not declare any constructor to initialize its non-modifiable members}}
7
+ T &M; // expected-note {{reference member 'M' will never be initialized}}
8
+ };
9
+
10
+ struct RefRef {
11
+ RefMem<int &> R; // expected-note {{in instantiation of template class 'RefMem<int &>' requested here}}
12
+ };
13
+
You can’t perform that action at this time.
0 commit comments