[clang] [C] Warn on uninitialized const objects (PR #137166)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Fri May 2 05:57:52 PDT 2025
================
@@ -8197,6 +8197,16 @@ def err_address_space_qualified_new : Error<
def err_address_space_qualified_delete : Error<
"'delete' cannot delete objects of type %0 in address space '%1'">;
+def note_default_init_const_member : Note<
+ "member %0 declared 'const' here">;
+def warn_default_init_const : Warning<
+ "default initialization of an object of type %0%select{| with const member}1 "
+ "is incompatible with C++">,
+ InGroup<DefaultConstInit>, DefaultIgnore;
+def warn_default_init_const_unsafe : Warning<
+ "default initialization of an object of type %0%select{| with const member}1 "
+ "leaves the object uninitialized and is incompatible with C++">,
----------------
AaronBallman wrote:
I posted https://github.com/llvm/llvm-project/pull/138266 to try to improve this, thank you for bringing it up!
https://github.com/llvm/llvm-project/pull/137166
More information about the cfe-commits
mailing list