[clang] [Clang] Fix assertion on delegating initializer when the class is an aggregate (PR #220830)
Akash Manna via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 8 04:56:47 PDT 2026
================
@@ -4802,7 +4802,10 @@ Sema::BuildDelegatingInitializer(TypeSourceInfo *TInfo, Expr *Init,
ExprResult DelegationInit = InitSeq.Perform(*this, DelegationEntity, Kind,
Args, nullptr);
if (!DelegationInit.isInvalid()) {
+ // If all user-provided constructors are invalid the class is still an
+ // aggregate, and the delegation is an aggregate initialization instead.
assert((DelegationInit.get()->containsErrors() ||
+ ClassDecl->isAggregate() ||
----------------
akash-manna-sky wrote:
Removed the assertion for now. Checking "all constructors invalid" is slightly odd here: `LookupDefaultConstructor` has already declared the implicit default constructor by this point I think, and the `containsErrors()` escape would still be needed. Failing earlier would add a second "no matching constructor" error on a constructor that is already diagnosed.
https://github.com/llvm/llvm-project/pull/220830
More information about the cfe-commits
mailing list