https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115639
--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> --- With static_assert(0==big_calc()); // (1) we evaluate the big_calc call twice. Once, while parsing the static_assert: #0 cxx_eval_call_expression (ctx=0x7fffffffc3e0, t=<call_expr 0x7fffea3c5b40>, lval=vc_prvalue, non_constant_p=0x7fffffffc50f, overflow_p=0x7fffffffc50e) at /home/mpolacek/src/gcc/gcc/cp/constexpr.cc:2801 #1 0x0000000000e45583 in cxx_eval_constant_expression (ctx=0x7fffffffc3e0, t=<call_expr 0x7fffea3c5b40>, lval=vc_prvalue, non_constant_p=0x7fffffffc50f, overflow_p=0x7fffffffc50e, jump_target=0x0) at /home/mpolacek/src/gcc/gcc/cp/constexpr.cc:7554 #2 0x0000000000e4b6b8 in cxx_eval_outermost_constant_expr (t=<call_expr 0x7fffea3c5b40>, allow_non_constant=true, strict=true, manifestly_const_eval=mce_value::mce_unknown, constexpr_dtor=false, object=<tree 0x0>) at /home/mpolacek/src/gcc/gcc/cp/constexpr.cc:8852 #3 0x0000000000e4c8ee in maybe_constant_value (t=<call_expr 0x7fffea3c5b40>, decl=<tree 0x0>, manifestly_const_eval=mce_value::mce_unknown) at /home/mpolacek/src/gcc/gcc/cp/constexpr.cc:9161 #4 0x0000000000e95c58 in cp_fully_fold (x=<call_expr 0x7fffea3c5b40>, manifestly_const_eval=mce_value::mce_unknown) at /home/mpolacek/src/gcc/gcc/cp/cp-gimplify.cc:2852 #5 0x0000000000e95dc7 in cp_fully_fold (x=<call_expr 0x7fffea3c5b40>) at /home/mpolacek/src/gcc/gcc/cp/cp-gimplify.cc:2871 #6 0x000000000122ee78 in cp_build_binary_op (location=..., code=EQ_EXPR, orig_op0=<non_lvalue_expr 0x7fffea3cd540>, orig_op1=<call_expr 0x7fffea3c5b40>, complain=3) at /home/mpolacek/src/gcc/gcc/cp/typeck.cc:6669 #7 0x0000000000dc774e in build_new_op (loc=..., code=EQ_EXPR, flags=1, arg1=<non_lvalue_expr 0x7fffea3cd540>, arg2=<call_expr 0x7fffea3c5b40>, arg3=<tree 0x0>, lookups=<tree 0x0>, overload=0x7fffffffcc30, complain=3) at /home/mpolacek/src/gcc/gcc/cp/call.cc:7516 and the second time while in finish_static_assert: #0 cxx_eval_call_expression (ctx=0x7fffffffce20, t=<call_expr 0x7fffea3c5b40>, lval=vc_prvalue, non_constant_p=0x7fffffffcf4f, overflow_p=0x7fffffffcf4e) at /home/mpolacek/src/gcc/gcc/cp/constexpr.cc:2801 #1 0x0000000000e45583 in cxx_eval_constant_expression (ctx=0x7fffffffce20, t=<call_expr 0x7fffea3c5b40>, lval=vc_prvalue, non_constant_p=0x7fffffffcf4f, overflow_p=0x7fffffffcf4e, jump_target=0x0) at /home/mpolacek/src/gcc/gcc/cp/constexpr.cc:7554 #2 0x0000000000e35b6b in cxx_eval_binary_expression (ctx=0x7fffffffce20, t=<eq_expr 0x7fffea3cc5a0>, lval=vc_prvalue, non_constant_p=0x7fffffffcf4f, overflow_p=0x7fffffffcf4e) at /home/mpolacek/src/gcc/gcc/cp/constexpr.cc:3820 #3 0x0000000000e46f1f in cxx_eval_constant_expression (ctx=0x7fffffffce20, t=<eq_expr 0x7fffea3cc5a0>, lval=vc_prvalue, non_constant_p=0x7fffffffcf4f, overflow_p=0x7fffffffcf4e, jump_target=0x0) at /home/mpolacek/src/gcc/gcc/cp/constexpr.cc:7966 #4 0x0000000000e4b6b8 in cxx_eval_outermost_constant_expr (t=<eq_expr 0x7fffea3cc5a0>, allow_non_constant=true, strict=true, manifestly_const_eval=mce_value::mce_true, constexpr_dtor=false, object=<tree 0x0>) at /home/mpolacek/src/gcc/gcc/cp/constexpr.cc:8852 #5 0x0000000000e4c7c2 in maybe_constant_value (t=<eq_expr 0x7fffea3cc5a0>, decl=<tree 0x0>, manifestly_const_eval=mce_value::mce_true) at /home/mpolacek/src/gcc/gcc/cp/constexpr.cc:9140 #6 0x0000000000e4ce02 in fold_non_dependent_expr (t=<eq_expr 0x7fffea3cc5a0>, complain=3, manifestly_const_eval=true, object=<tree 0x0>) at /home/mpolacek/src/gcc/gcc/cp/constexpr.cc:9280 #7 0x00000000011dd851 in finish_static_assert (condition=<eq_expr 0x7fffea3cc5a0>, message=<string_cst 0x7fffcde811f8>, location=2147483661, member_p=false, show_expr_p=false) at /home/mpolacek/src/gcc/gcc/cp/semantics.cc:11887 The second time around, we're not finding the call in constexpr_call_table.