https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111343
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Untested fix below. I wasn't aware any targets would actually have float the same as double. C++23 says here: http://eel.is/c++draft/conv.rank#2.2 that double has higher rank than float http://eel.is/c++draft/conv.rank#2.5 and that extended type with same set of values as 2+ standard types has same rank as double. As I've only thought about the double same as long double case, I've only handled that case there. No testcase for testsuite, as this needs to be tested in avr/sh specific g++.target only and needs proper options/effective target macros to find out if that is really the float same as double configuration. Will defer testcases to the respective target maintainers. 2024-06-17 Jakub Jelinek <ja...@redhat.com> PR target/111343 PR c++/115511 * typeck.cc (cp_compare_floating_point_conversion_ranks): If an extended floating point type mv1 has same set of values as more than one standard floating point type and mv2 is float, return 2. --- gcc/cp/typeck.cc.jj 2024-06-04 13:19:03.755604346 +0200 +++ gcc/cp/typeck.cc 2024-06-17 10:32:02.063088961 +0200 @@ -393,6 +393,9 @@ cp_compare_floating_point_conversion_ran has higher rank. */ if (cnt > 1 && mv2 == long_double_type_node) return -2; + /* And similarly if t2 is float, t2 has lower rank. */ + if (cnt > 1 && mv2 == float_type_node) + return 2; /* Otherwise, they have equal rank, but extended types (other than std::bfloat16_t) have higher subrank. std::bfloat16_t shouldn't have equal rank to any standard