ayzhao added inline comments.

================
Comment at: clang/lib/Sema/SemaInit.cpp:5380
+          }
+          InitExprs.push_back(ER.get());
+        }
----------------
ayzhao wrote:
> 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.
I was able to get the above workaround to pass the test by clearing the 
diagnostics after calling `Seq.Perform(...)`.

IMO, this should be OK for now, but I'm open to better ideas if anyone has any.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D129531/new/

https://reviews.llvm.org/D129531

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to