https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115583
--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The trunk branch has been updated by Jason Merrill <ja...@gcc.gnu.org>: https://gcc.gnu.org/g:d5f1948640815a554d106542c2e91e4e117aa3bc commit r15-2369-gd5f1948640815a554d106542c2e91e4e117aa3bc Author: Jason Merrill <ja...@redhat.com> Date: Sat Jul 27 16:40:02 2024 -0400 c++: if consteval and consteval propagation [PR115583] During speculative constant folding of an if consteval, we take the false branch, but the true branch is an immediate function context, so we don't want to to cp_fold_immediate it. So we could check IF_STMT_CONSTEVAL_P here. But beyond that, we don't want to do this inside a call, only when first parsing a function. PR c++/115583 gcc/cp/ChangeLog: * constexpr.cc (cxx_eval_conditional_expression): Don't cp_fold_immediate for if consteval. gcc/testsuite/ChangeLog: * g++.dg/cpp23/consteval-if13.C: New test.