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

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 27 11:38:57 PDT 2023


================
@@ -221,6 +221,15 @@ ExprResult Parser::ParseConstantExpression() {
   return ParseConstantExpressionInExprEvalContext(NotTypeCast);
 }
 
+ExprResult Parser::ParseArrayBoundExpression() {
+  EnterExpressionEvaluationContext ConstantEvaluated(
+      Actions, Sema::ExpressionEvaluationContext::ConstantEvaluated);
+  // If we parse the bound of a VLA... we parse a non-constant
+  // constant-expression!
+  Actions.ExprEvalContexts.back().InConditionallyConstantEvaluateContext = true;
----------------
erichkeane wrote:

I think I'd rather this be an argument to the above constructor here.

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


More information about the cfe-commits mailing list