[clang] [clang] Fix parenthesized list initialization of arrays not working with `new` (PR #76976)

via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 4 11:10:20 PST 2024


================
@@ -1073,7 +1075,7 @@ void CodeGenFunction::EmitNewArrayInitializer(
       return;
     }
 
-    InitListElements = ILE->getNumInits();
+    InitListElements = ILE ? ILE->getNumInits() : CPLIE->getInitExprs().size();
----------------
cor3ntin wrote:

This is not great, but I think it will do for now.
Maybe we want to have both CXXParenListInitExpr and  InitListExpr inherit from some abstract base class that implement some of the shared functionality with CRTP. We'd avoid all these if.

I don't think we need to do that in this patch though


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


More information about the cfe-commits mailing list