On 12/4/23 15:23, Marek Polacek wrote:
+/* FN is not a consteval function, but may become one. Remember to
+ escalate it after all pending templates have been instantiated. */
+
+void
+maybe_store_immediate_escalating_fn (tree fn)
+{
+ if (unchecked_immediate_escalating_function_p (fn))
+ remember_escalating_expr (fn);
+}
+++ b/gcc/cp/decl.cc
@@ -18441,7 +18441,10 @@ finish_function (bool inline_p)
if (!processing_template_decl
&& !DECL_IMMEDIATE_FUNCTION_P (fndecl)
&& !DECL_OMP_DECLARE_REDUCTION_P (fndecl))
- cp_fold_function (fndecl);
+ {
+ cp_fold_function (fndecl);
+ maybe_store_immediate_escalating_fn (fndecl);
+ }
I think maybe_store_, and the call to it from finish_function, are
unneeded; we will have already decided whether we need to remember the
function during the call to cp_fold_function.
OK with that change.
Jason