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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
              Alias|                            |cwg2596
            Summary|Rejects-valid:              |[CWG2596] Rejects-valid:
                   |instantiation of class      |instantiation of class
                   |template instantiates (all) |template instantiates (all)
                   |constrained non-template    |constrained non-template
                   |friend definitions (, even  |friend definitions (, even
                   |those) with unsatisfied     |those) with unsatisfied
                   |constraints                 |constraints
             Blocks|                            |94404

--- Comment #4 from Patrick Palka <ppalka at gcc dot gnu.org> ---
>From r13-4035-gc41bbfcaf9d6ef:

commit c41bbfcaf9d6ef5b57a7e89bba70b861c08a686b
Date:   Fri Nov 11 00:45:02 2022 -1000

    c++: only declare satisfied friends

    A friend declaration can only have constraints if it is defined.  If
    multiple instantiations of a class template define the same friend function
    signature, it's an error, but that shouldn't happen if it's constrained to
    only be declared in one instantiation.

    Currently we don't mangle requirements, so the foos all mangle the same and
    actually instantiating #1 will break, but for now we can test that they're
    considered distinct.

    gcc/cp/ChangeLog:

            * pt.cc (tsubst_friend_function): Check satisfaction.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp2a/concepts-friend11.C: New test.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94404
[Bug 94404] [meta-bug] C++ core issues

Reply via email to