https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100367

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Jason Merrill
<ja...@gcc.gnu.org>:

https://gcc.gnu.org/g:3bdd3e45955ef94a1f2db51a2af1ded54d41f670

commit r11-8437-g3bdd3e45955ef94a1f2db51a2af1ded54d41f670
Author: Jason Merrill <ja...@redhat.com>
Date:   Tue May 18 12:29:33 2021 -0400

    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.

Reply via email to