[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


================
@@ -1101,7 +1103,8 @@ void CodeGenFunction::EmitNewArrayInitializer(
     }
 
     CharUnits StartAlign = CurPtr.getAlignment();
-    for (unsigned i = 0, e = ILE->getNumInits(); i != e; ++i) {
+    ArrayRef<Expr *> InitExprs = ILE ? ILE->inits() : CPLIE->getInitExprs();
+    for (unsigned i = 0; i < InitExprs.size(); ++i) {
----------------
cor3ntin wrote:

You could use a range for loop here

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


More information about the cfe-commits mailing list