https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125378
--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-16 branch has been updated by Patrick Palka <[email protected]>: https://gcc.gnu.org/g:6eaecfb5923306e46ab0baafaf41f56f73dc685e commit r16-9052-g6eaecfb5923306e46ab0baafaf41f56f73dc685e 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]> (cherry picked from commit 5dc5dd6ed9b4759d278a07f95949c3f241626651)
