[clang] [clang][constexpr] Evaluate parenthesized array new with the allocated bound (PR #228675)
Macro Terra via cfe-commits
cfe-commits at lists.llvm.org
Sun Oct 4 05:53:32 PDT 2026
hongtaihu wrote:
> You need to fix the bytecode interpreter too:
>
> ```diff
> diff --git i/clang/lib/AST/ByteCode/Compiler.cpp w/clang/lib/AST/ByteCode/Compiler.cpp
> index 313687f53816..58e68de845c9 100644
> --- i/clang/lib/AST/ByteCode/Compiler.cpp
> +++ w/clang/lib/AST/ByteCode/Compiler.cpp
> @@ -4384,6 +4384,10 @@ bool Compiler<Emitter>::VisitCXXNewExpr(const CXXNewExpr *E) {
> DynamicInit = ILE->getArrayFiller();
> else if (StaticInitElems > 0 && isa<StringLiteral>(ILE->getInit(0)))
> ElemT = classifyPrim(CAT->getElementType());
> + } else if (const auto *PLI = dyn_cast<CXXParenListInitExpr>(Init)) {
> + DynamicInit = PLI->getArrayFiller();
> + if (StaticInitElems > 0 && isa<StringLiteral>(PLI->getInitExprs()[0]))
> + ElemT = classifyPrim(CAT->getElementType());
> }
> }
> ```
done
https://github.com/llvm/llvm-project/pull/228675
More information about the cfe-commits
mailing list