https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107542
--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-12 branch has been updated by Patrick Palka <ppa...@gcc.gnu.org>: https://gcc.gnu.org/g:37595f8354e3e48e4a1a94537f3d1ae095ed75df commit r12-8994-g37595f8354e3e48e4a1a94537f3d1ae095ed75df Author: Patrick Palka <ppa...@redhat.com> Date: Tue Nov 29 19:25:37 2022 -0500 c++: ICE with <=> of incompatible pointers [PR107542] In a SFINAE context composite_pointer_type returns error_mark_node if the given pointer types are incompatible. But the SPACESHIP_EXPR case of cp_build_binary_op wasn't prepared for this error_mark_node result, which led to an ICE (from spaceship_comp_cat) for the below testcase. (In a non-SFINAE context composite_pointer_type issues a permerror and returns cv void* in this case, so this ICE seems specific to SFINAE.) PR c++/107542 gcc/cp/ChangeLog: * typeck.cc (cp_build_binary_op): In the SPACESHIP_EXPR case, handle an error_mark_node result type. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/spaceship-sfinae2.C: New test. (cherry picked from commit 000e9863120cbc75a0f8d497264519974c97669f)