[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)
Shafik Yaghmour via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 21 10:26:30 PDT 2024
================
@@ -1392,7 +1392,8 @@ class CXXRecordDecl : public RecordDecl {
bool allowConstDefaultInit() const {
return !data().HasUninitializedFields ||
!(data().HasDefaultedDefaultConstructor ||
- needsImplicitDefaultConstructor());
+ needsImplicitDefaultConstructor()) ||
+ hasInClassInitializer();
----------------
shafik wrote:
Based on the comment in the bug report I think this needs to be `(isUnion() && hasInClassInitializer())`
https://github.com/llvm/llvm-project/pull/96301
More information about the cfe-commits
mailing list