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

via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 27 13:18:58 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;
----------------
cor3ntin wrote:

@erichkeane this constructor already has a bunch of defaulted boolean / pointer parameters, it would be a mess. We'd need to add a tag which seems overkill for 1 use

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


More information about the cfe-commits mailing list