https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113529
--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Patrick Palka <ppa...@gcc.gnu.org>: https://gcc.gnu.org/g:fecb45a936d62ca24dd8b4985ea0555c28edefa8 commit r14-8402-gfecb45a936d62ca24dd8b4985ea0555c28edefa8 Author: Patrick Palka <ppa...@redhat.com> Date: Wed Jan 24 17:11:09 2024 -0500 c++: ambiguous member lookup for rewritten cands [PR113529] Here we handle the operator expression u < v inconsistently: in a SFINAE context we accept it, and in a non-SFINAE context we reject it with error: request for member 'operator<=>' is ambiguous as per [class.member.lookup]/6. This inconsistency is ultimately because we neglect to propagate error_mark_node after recursing in add_operator_candidates, fixed like so. PR c++/113529 gcc/cp/ChangeLog: * call.cc (add_operator_candidates): Propagate error_mark_node result after recursing to find rewritten candidates. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/spaceship-sfinae3.C: New test. Reviewed-by: Jason Merrill <ja...@redhat.com>