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

--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <[email protected]>:

https://gcc.gnu.org/g:c1a7d0a2140563198fef1a704029c5a9546e77a0

commit r17-2127-gc1a7d0a2140563198fef1a704029c5a9546e77a0
Author: Jakub Jelinek <[email protected]>
Date:   Fri Jul 3 20:43:22 2026 +0200

    c++: Implement C++29 P2953R5 - Adding restrictions to defaulted assignment
operator functions [PR125826]

    The following patch attempts to implement the C++29 P2953R5
    Adding restrictions to defaulted assignment operator functions
    paper.
    The paper seems to be misnamed to me because it changes the validity
    of defaulted constructors as well in some cases.

    What the patch does is that it calls maybe_delete_defaulted_fn
    also for the FUNCTION_RVALUE_QUALIFIED case for C++29, and then in
    maybe_delete_defaulted_fn for C++29 errors rather than making the
    function deleted in most cases, with the exception of
    [dcl.fct.def.default]/(2.5) case which ought to be still deleted
    rather than ill-formed (but only if that is the sole change that
    is not on the whitelist of possible differences).

    I've tried to include all the tests I found in the paper (referenced or
    directly in it) with the exception of the https://gcc.gnu.org/PR86646
    case, added some further ones and tweaked anything in the existing
    test that behaves differently for -std=c++29 with the patch.

    2026-07-03  Jakub Jelinek  <[email protected]>

            PR c++/125826
            * method.cc: Implement C++29 P2953R5 - Adding restrictions to
            defaulted assignment operator functions.
            (maybe_delete_defaulted_fn): For C++29, error instead of
            deleting always, with the exception of F1 having parmtype
            const C & and F2 having implicit_parmtype C & and no other
            non-permitted changes.  Move checks whether defaulted fn
            should be deleted or ill-formed at all from defaulted_late_check
            to this function.  Also error for C++29 if
            FUNCTION_RVALUE_QUALIFIED.
            (defaulted_late_check): Call maybe_delete_defaulted_fn
            unconditionally.

            * g++.dg/cpp0x/defaulted51.C: Adjust expected diagnostics
            for C++29.
            * g++.dg/cpp0x/defaulted55.C: Likewise.
            * g++.dg/cpp0x/defaulted56.C: Likewise.
            * g++.dg/cpp0x/defaulted57.C: Likewise.
            * g++.dg/cpp0x/defaulted63.C: Likewise.
            * g++.dg/cpp0x/defaulted64.C: Likewise.
            * g++.dg/cpp0x/defaulted65.C: Likewise.
            * g++.dg/cpp0x/defaulted66.C: Likewise.
            * g++.dg/cpp0x/defaulted67.C: Likewise.
            * g++.dg/cpp0x/defaulted68.C: Likewise.
            * g++.dg/cpp1y/defaulted2.C: Likewise.
            * g++.dg/cpp29/defaulted1.C: New test.
            * g++.dg/cpp29/defaulted2.C: New test.
            * g++.dg/cpp29/defaulted3.C: New test.
            * g++.dg/cpp29/defaulted4.C: New test.
            * g++.dg/cpp29/defaulted5.C: New test.
            * g++.dg/cpp29/defaulted6.C: New test.

    Reviewed-by: Jason Merrill <[email protected]>

Reply via email to