[clang] [Clang] Fix crash on `void{}` (PR #147514)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 15 06:26:30 PDT 2025


================
@@ -2114,8 +2114,10 @@ static int getAsInt32(llvm::ConstantInt *C, llvm::Type *I32Ty) {
 Value *ScalarExprEmitter::VisitInitListExpr(InitListExpr *E) {
   bool Ignore = TestAndClearIgnoreResultAssign();
   (void)Ignore;
-  assert (Ignore == false && "init list ignored");
   unsigned NumInitElements = E->getNumInits();
+  assert(Ignore == false ||
+         (NumInitElements == 0 && E->getType()->isVoidType()) &&
+             "init list ignored");
----------------
erichkeane wrote:

See https://github.com/llvm/llvm-project/pull/158635

https://github.com/llvm/llvm-project/pull/147514


More information about the cfe-commits mailing list