[clang] Add Clang attribute to ensure that fields are initialized explicitly (PR #102040)
Ilya Biryukov via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 13 05:15:33 PDT 2024
================
@@ -2148,6 +2158,19 @@ void CXXRecordDecl::completeDefinition(CXXFinalOverriderMap *FinalOverriders) {
for (conversion_iterator I = conversion_begin(), E = conversion_end();
I != E; ++I)
I.setAccess((*I)->getAccess());
+
+ ASTContext &Context = getASTContext();
+ if (!Context.getLangOpts().CPlusPlus20 && hasUserDeclaredConstructor()) {
----------------
ilya-biryukov wrote:
We should probably complaint only if the type is aggregate in the first place, right?
See https://gcc.godbolt.org/z/sa94xa9or for an example code.
https://github.com/llvm/llvm-project/pull/102040
More information about the cfe-commits
mailing list