[clang] [clang] Allow class with anonymous union member to be const-default-constructible even if a union member has a default member initializer (#95854) (PR #96301)

Rajveer Singh Bharadwaj via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 25 00:15:11 PDT 2024


================
@@ -1392,7 +1392,8 @@ class CXXRecordDecl : public RecordDecl {
   bool allowConstDefaultInit() const {
     return !data().HasUninitializedFields ||
            !(data().HasDefaultedDefaultConstructor ||
-             needsImplicitDefaultConstructor());
+             needsImplicitDefaultConstructor()) ||
+           hasInClassInitializer();
----------------
Rajveer100 wrote:

@zygoloid 
Is there an existing method for checking nested structures for cases like you mentioned above?

https://github.com/llvm/llvm-project/pull/96301


More information about the cfe-commits mailing list