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
391391
392392 Fixes #GH131127
393393
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+
394398Improvements to Clang's time-trace
395399----------------------------------
396400
Original file line number Diff line number Diff line change @@ -2266,7 +2266,8 @@ def err_constructor_byvalue_arg : Error<
22662266 "copy constructor must pass its first argument by reference">;
22672267def warn_no_constructor_for_refconst : Warning<
22682268 "%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>;
22702271def note_refconst_member_not_initialized : Note<
22712272 "%select{const|reference}0 member %1 will never be initialized">;
22722273def 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:
1818
1919The list of warnings below should NEVER grow . It should gradually shrink to 0.
2020
21- CHECK : Warnings without flags (57 ):
21+ CHECK : Warnings without flags (56 ):
2222
2323CHECK - NEXT : ext_expected_semi_decl_list
2424CHECK - NEXT : ext_missing_whitespace_after_macro_name
@@ -57,7 +57,6 @@ CHECK-NEXT: warn_method_param_redefinition
5757CHECK - NEXT : warn_missing_case_for_condition
5858CHECK - NEXT : warn_missing_dependent_template_keyword
5959CHECK - NEXT : warn_missing_whitespace_after_macro_name
60- CHECK - NEXT : warn_no_constructor_for_refconst
6160CHECK - NEXT : warn_not_compound_assign
6261CHECK - NEXT : warn_objc_property_copy_missing_on_block
6362CHECK - 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