[clang] [Clang] Handle consteval expression in array bounds expressions (PR #66222)

Takuya Shimizu via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 14 22:35:59 PDT 2023


hazohelet wrote:

> Where do you think it matters? I can't this of cases where ConstantEvaluated context are nested in one another without some intertwined potentially evaluated context

I was mostly thinking about cases where the array-bound expression appears inside immediate function context.
The current checks for "Is this always constant-evaluated?" only see the innermost evaluation context (e.g. `Sema::isConstantEvaluated`, and `Sema::DiagRuntimeBehavior`), so I hope the newly pushed evaluation contexts on `ExprEvalContexts` be strict about whether it's always-constant-evaluated or not.
Although this PR is not relevant, for the same reason, I don't think it's ideal that potentially-evaluated-contexts appear inside constant-evaluated context.

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


More information about the cfe-commits mailing list