================ @@ -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:
This code is assuming the initializer for an array must be one of the following: - An InitListExpr with a list of elements - A CXXParentListInitExpr with a list of elements - An InitListExpr with a "string" (isStringLiteralInit is true) - A StringLiteral Looking at the standard, I guess this is a complete list. The last one seems a little suspect to me, though; if it's using the same IsStringInit() as InitListExpr does, a "string" might not be a StringLiteral. https://github.com/llvm/llvm-project/pull/76976 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits