https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104606
--- Comment #23 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-14 branch has been updated by Patrick Palka <ppa...@gcc.gnu.org>: https://gcc.gnu.org/g:d23d35d3b76aa2ca124e580908f56f4b249cfe3a commit r14-11697-gd23d35d3b76aa2ca124e580908f56f4b249cfe3a Author: Patrick Palka <ppa...@redhat.com> Date: Fri Feb 28 10:15:45 2025 -0500 libstdc++: Improve optional's <=> constraint recursion workaround [PR104606] It turns out the reason the behavior of this testcase changed after CWG 2369 is because validity of the substituted return type is now checked later, after constraints. So a more reliable workaround for this issue is to add a constraint to check the validity of the return type earlier, matching the pre-CWG 2369 semantics. PR libstdc++/104606 libstdc++-v3/ChangeLog: * include/std/optional (operator<=>): Revert r14-9771 change. Add constraint checking the validity of the return type compare_three_way_result_t before the three_way_comparable_with constraint. Reviewed-by: Jonathan Wakely <jwak...@redhat.com> (cherry picked from commit 815f1f27a1dba2f0acd1f02d0beafedadebe967c)