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

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppa...@gcc.gnu.org>:

https://gcc.gnu.org/g:8eb329e963593342855b6072e5692659107337b7

commit r12-7076-g8eb329e963593342855b6072e5692659107337b7
Author: Patrick Palka <ppa...@redhat.com>
Date:   Sun Feb 6 10:47:48 2022 -0500

    c++: dependent noexcept-spec on defaulted comparison op [PR96242]

    Here we're failing to instantiate the defaulted comparison op's
    explicit dependent noexcept-spec.  The problem is ultimately that
    mark_used relies on maybe_instantiate_noexcept to synthesize a defaulted
    comparison op, but the relevant DECL_MAYBE_DELETED fn handling in m_i_n
    is intended for such functions whose noexcept-spec wasn't explicitly
    provided (and is therefore determined via synthesis), so m_i_n just
    exits early afterwards, without considering that the synthesized fn may
    have an explicit noexcept-spec that needs instantiating.

    This patch fixes this issue by making mark_used directly synthesize a
    DECL_MAYBE_DELETED fn before calling maybe_instantiate_noexcept.  And
    in turn, we can properly restrict the DECL_MAYBE_DELETED fn synthesis
    in m_i_n to only those without an explicit noexcept-spec.

            PR c++/96242

    gcc/cp/ChangeLog:

            * decl2.cc (mark_used): Directly synthesize a DECL_MAYBE_DELETED
            fn by calling maybe_synthesize_method instead of relying on
            maybe_instantiate_noexcept.  Move call to m_i_n after the
            DECL_DELETED_FN handling.
            * pt.cc (maybe_instantiate_noexcept): Restrict DECL_MAYBE_DELETED
            fn synthesis to only those with an implicit noexcept-spec, and
            return !DECL_DELETED_FN instead of !DECL_MAYBE_DELETED afterwards.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp2a/spaceship-synth15.C: New test.
  • [Bug c++/96242] ICE conditional... cvs-commit at gcc dot gnu.org via Gcc-bugs

Reply via email to