https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125378
--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Patrick Palka <[email protected]>: https://gcc.gnu.org/g:5dc5dd6ed9b4759d278a07f95949c3f241626651 commit r17-1277-g5dc5dd6ed9b4759d278a07f95949c3f241626651 Author: Patrick Palka <[email protected]> Date: Wed Jun 3 18:04:12 2026 -0400 c++: non-dep cmp op rewritten from <=> returning char [PR125378] When a user operator<=> returns an integral type smaller than int, the rewritten form of x @ y contains an integer promotion: (int)(x <=> y) @ 0. This patch teaches build_min_non_dep_op_overload to look through and preserve this implicit cast. PR c++/125378 gcc/cp/ChangeLog: * tree.cc (build_min_non_dep_op_overload): Handle comparison operator expressions rewritten from a <=> that contain an integer promotion. gcc/testsuite/ChangeLog: * g++.dg/lookup/operator-8b.C: New test. * g++.dg/lookup/operator-8c.C: New test. * g++.dg/lookup/operator-9a.C: New test. * g++.dg/lookup/operator-9b.C: New test. Reviewed-by: Jason Merrill <[email protected]> Reviewed-by: Marek Polacek <[email protected]>
