@@ -22952,7 +22952,6 @@ callee; the iwp_1st_resume visit completes the call in the latter case.
2295222952 a_boolean eval_right_to_left =
2295322953 call_node->variant.operation.eval_right_to_left;
2295422954 work_item_result_cap(item, &result_cap);
22955- up_front_cost = charge_call_cost(ips);
2295622955 /* Set up arguments, starting with "this" if applicable. */
2295722956 /* This process must happen in two phases. First, the arguments must be
2295822957 allocated and evaluated. Only then can we map parameter variables onto
@@ -23165,6 +23164,7 @@ callee; the iwp_1st_resume visit completes the call in the latter case.
2316523164 should perform some more work (like mapping parameters) in case the
2316623165 intrinsic handling falls back to the provided definition (as, e.g.,
2316723166 std::construct_at does). */
23167+ up_front_cost = charge_call_cost(ips);
2316823168 push_new_call_frame(ips, callee, &call_node->position, result_cap);
2316923169 result = do_constexpr_intrinsic_call(
2317023170 ips, callee, call_node, (a_byte**)arg_ptrs,
@@ -23254,6 +23254,11 @@ callee; the iwp_1st_resume visit completes the call in the latter case.
2325423254 p_arg_ptr += 1;
2325523255 arg_size += 1;
2325623256 } /* for */
23257+ /* Charge for the call only now that the arguments have been evaluated.
23258+ A call nested in an argument (e.g., the "f(n-1)" in "g(f(n-1))") is
23259+ not nested in this call, and charging earlier would make it count
23260+ twice toward the call depth limit. */
23261+ up_front_cost = charge_call_cost(ips);
2325723262 /* Set up the call frame. */
2325823263 push_new_call_frame(ips, callee, &call_node->position, result_cap);
2325923264 /* Record what finish_call_work needs to undo all of the above. */
@@ -23499,7 +23504,6 @@ after the constructor body has been interpreted.
2349923504 class_type, ips);
2350023505 goto done;
2350123506 } /* if */
23502- up_front_cost = charge_call_cost(ips);
2350323507 /* Set up arguments, starting with "this" if applicable. */
2350423508 /* This process must happen in two phases. First, the arguments must be
2350523509 allocated and evaluated. Only then can we map parameter variables onto
@@ -23656,6 +23660,9 @@ after the constructor body has been interpreted.
2365623660 memzero(result_storage+sizeof(void*),
2365723661 size_t_arg(n_class_bytes-sizeof(void*)));
2365823662 } /* if */
23663+ /* Charge for the call only now that the arguments have been evaluated
23664+ (see process_call_work). */
23665+ up_front_cost = charge_call_cost(ips);
2365923666 /* Set up the call frame. */
2366023667 push_new_call_frame(ips, callee, pos, cap);
2366123668 /* Mark all the empty base class subobjects as initialized. */
0 commit comments