[clang] [Clang] Handle consteval expression in array bounds expressions (PR #66222)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 14 23:24:16 PDT 2023
cor3ntin wrote:
> My patch needs modification so that use of `is_constant_evaluated` and consteval-if NOT considered tautologically-true when they happen `InConditionallyConstantEvaluateContext`, which is a few lines of change.
Hum, maybe to do that we need to set ahead of time whether we support VLAs or not because if we don't then it's not tautological... But if we do that then whether we get tautological warnings depend on the value of `Wvla` , which is interesting. At the same time, if user disable vla support they ought to have well behaving arrays so maybe that's our best option
> I was mostly thinking about cases where the array-bound expression appears inside immediate function context.
I'll add a test. immediate contexts are recursive, constant evaluated contexts are not, i don't think there is a case where you would get an additional evaluation context that is not for a full expression, and if you have a full expression you do expect the immediate invocation to be called anyway - eg, lambda case.
http://eel.is/c++draft/expr#const-19
https://github.com/llvm/llvm-project/pull/66222
More information about the cfe-commits
mailing list