From 186d6df4c3e612667b1eb945ce3e27a92e2cb485 Mon Sep 17 00:00:00 2001 From: Zachary Snow Date: Mon, 7 Dec 2020 13:52:44 -0700 Subject: Allow constant function calls in constant function arguments --- frontends/ast/simplify.cc | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'frontends/ast') diff --git a/frontends/ast/simplify.cc b/frontends/ast/simplify.cc index fb6623f02..8e205cb76 100644 --- a/frontends/ast/simplify.cc +++ b/frontends/ast/simplify.cc @@ -1205,6 +1205,11 @@ bool AstNode::simplify(bool const_fold, bool at_zero, bool in_lvalue, int stage, current_block = this; current_block_child = children[i]; } + if (!in_param_here && type == AST_FCALL) { + bool recommend_const_eval = false; + bool require_const_eval = has_const_only_constructs(recommend_const_eval); + in_param_here = recommend_const_eval || require_const_eval; + } if ((type == AST_ALWAYS || type == AST_INITIAL) && children[i]->type == AST_BLOCK) current_top_block = children[i]; if (i == 0 && child_0_is_self_determined) -- cgit v1.2.3