[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)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 27 11:03:32 PDT 2024
================
@@ -1392,7 +1392,8 @@ class CXXRecordDecl : public RecordDecl {
bool allowConstDefaultInit() const {
return !data().HasUninitializedFields ||
!(data().HasDefaultedDefaultConstructor ||
- needsImplicitDefaultConstructor());
+ needsImplicitDefaultConstructor()) ||
+ hasInClassInitializer();
----------------
ofAlpaca wrote:
Hi @zygoloid
I apologize if it's a silly question, I'm new here and want to learn something from you.
@Rajveer100's commit has already fixed the test (GH95854.cpp).
> The two tests that were broken:
And these two mentioned testcases' errors are expected. The behavior of the fix is correct.
Then, what are you planning to do next?
Are you planning to improve the code by changing the behavior of `HasUninitializedFields`?
https://github.com/llvm/llvm-project/pull/96301
More information about the cfe-commits
mailing list