c++: ICE with <=> fallback [PR100367]
Here, when genericizing lexicographical_compare_three_way, we haven't yet walked the operands, so (a == a) still sees ADDR_EXPR <a>, but this is after we've changed the type of a to REFERENCE_TYPE. When we try to fold (a == a) by constexpr evaluation, the constexpr code doesn't understand trying to take the address of a reference, and we end up crashing. Fixed by avoiding constexpr evaluation in genericize_spaceship, by using fold_build2 instead of build_new_op on scalar operands. Class operands should have been expanded during parsing. PR c++/100367 PR c++/96299 gcc/cp/ChangeLog: * method.c (genericize_spaceship): Use fold_build2 for scalar operands. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/spaceship-fallback1.C: New test.
Loading
Please register or sign in to comment