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

via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 14 05:09:26 PDT 2023


cor3ntin wrote:

> Is it alright to set `InConditionallyConstantEvaluateContext` true only when the outer evaluation context `isAlwaysConstantEvaluatedContext()` so that we can say the array bound expr is always constant-evaluated if it happens in always-constant-evaluated context?

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

> Also, does this change suggest that we let some diagnostic mechanisms consider VLA cases? (e.g. DiagRuntimeBehavior should not early-return if the context is InConditionallyConstantEvaluateContext to diagnose div-by-zero in https://godbolt.org/z/556rKnMTG)

Yes. We probably should fix that (i think it's a separate patch)

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


More information about the cfe-commits mailing list