================
@@ -1395,7 +1395,8 @@ class CXXRecordDecl : public RecordDecl {
   bool allowConstDefaultInit() const {
     return !data().HasUninitializedFields ||
            !(data().HasDefaultedDefaultConstructor ||
-             needsImplicitDefaultConstructor());
+             needsImplicitDefaultConstructor()) ||
+           (isUnion() && isEmpty());
----------------
Sirraide wrote:

Er, why do we special-case empty unions here? Shouldn’t that just work 
automatically because an empty union has no fields at all and therefore no 
uninitialised fields either?

https://github.com/llvm/llvm-project/pull/96301
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to