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

Eli Friedman via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 17 12:52:36 PST 2024


================
@@ -1038,11 +1038,14 @@ void CodeGenFunction::EmitNewArrayInitializer(
     return true;
   };
 
+  const InitListExpr *ILE = dyn_cast<InitListExpr>(Init);
+  const CXXParenListInitExpr *CPLIE = dyn_cast<CXXParenListInitExpr>(Init);
+  const StringLiteral *SL = dyn_cast<StringLiteral>(Init);
   // If the initializer is an initializer list, first do the explicit elements.
-  if (const InitListExpr *ILE = dyn_cast<InitListExpr>(Init)) {
+  if (ILE || CPLIE || SL) {
----------------
efriedma-quic wrote:

That's fine.

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


More information about the cfe-commits mailing list