[PATCH] D129531: [clang][C++20] P0960R3 and P1975R0: Allow initializing aggregates from a parenthesized list of values
Alan Zhao via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Dec 7 17:32:24 PST 2022
ayzhao added inline comments.
================
Comment at: clang/lib/Sema/SemaInit.cpp:5380
+ }
+ InitExprs.push_back(ER.get());
+ }
----------------
So the libc++ test compile failures are due to this line.
One example of a failing unit test is [range.take.while/ctor.view.pass](https://github.com/llvm/llvm-project/blob/main/libcxx/test/std/ranges/range.adaptors/range.take.while/ctor.view.pass.cpp). Clang calls this function twice in `TreeTransform.h` - once with `VerifyOnly` set to `true`, once with it set to `false`.
For some reason, when this function tries to value-initialize the member `MoveOnly mo` in `View`, `Seq.Failed()` returns false after `TryValueInitialization(...)`, but the resulting `ExprResult` is `nullptr`, causing the segfault we see when we push `nullptr` to `InitExprs` and pass `InitExprs` to the constructor of `CXXParenListInitExpr`. One way to be fix this is to move the line `ExprResult ER = Seq.Perform(...)` out of the `if (!VerifyOnly)` block and check for `ER.isInvalid()` instead of `Seq.Failed()`, but that results in test failures due to excess diagnostic messages in `Seq.Perform(...)`
I'm still looking into this, but if anyone has any ideas, they would be very welcome.
To repro the buildbot failures, just build clang with this patch, and then in a separate build directory, build the target `check-cxx` using the previously built clang.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D129531/new/
https://reviews.llvm.org/D129531
More information about the cfe-commits
mailing list