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 <jason@redhat.com>
Reviewed-by: Marek Polacek <polacek@redhat.com>
(cherry picked from commit 5dc5dd6ed9b4759d278a07f95949c3f241626651)
5 files changed