[clang] Add Clang attribute to ensure that fields are initialized explicitly (PR #102040)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 20 11:35:18 PST 2024
================
@@ -2302,6 +2302,10 @@ def err_init_list_bad_dest_type : Error<
def warn_cxx20_compat_aggregate_init_with_ctors : Warning<
"aggregate initialization of type %0 with user-declared constructors "
"is incompatible with C++20">, DefaultIgnore, InGroup<CXX20Compat>;
+def warn_cxx20_compat_requires_explicit_init_non_aggregate : Warning<
+ "explicit initialization of field %0 may not be enforced in C++20 as type %1 "
+ "will become a non-aggregate due to the presence of user-declared "
+ "constructors">, DefaultIgnore, InGroup<CXX20Compat>;
----------------
AaronBallman wrote:
```suggestion
"explicit initialization of field %0 will not be enforced in C++20 and later because %1 "
"has a user-declared constructor, making the type no longer an aggregate">,
DefaultIgnore, InGroup<CXX20Compat>;
```
https://github.com/llvm/llvm-project/pull/102040
More information about the cfe-commits
mailing list