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

--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-15 branch has been updated by Patrick Palka
<ppa...@gcc.gnu.org>:

https://gcc.gnu.org/g:9faa21a4de2b88366e363b6817ee751ea8d13f53

commit r15-10209-g9faa21a4de2b88366e363b6817ee751ea8d13f53
Author: Patrick Palka <ppa...@redhat.com>
Date:   Mon Aug 4 16:51:00 2025 -0400

    c++: constrained memfn vs corresponding using [PR121351]

    The b.f(42) calls in the below testcases started to get rejected as
    ambiguous after r15-3740 which corrected our inheritedness tiebreaker to
    only apply to constructors (and not all member functions) as per CWG2273.

    But arguably these calls should still be valid regardless of the
    tiebreaker because B::f corresponds to and therefore hides A::f, so
    there should only be a single candidate in the first place.  This
    doesn't happen because when determining correspondence we compare
    the members' uninstantiated constraints instead of their partially
    substituted constraints as in other declaration matching situations.
    It doesn't really make sense to compare uninstantiated constraints
    from two different template contexts.

    This patch fixes this by substituting in outer template arguments before
    comparing constraints of two potentially corresponding member functions.

            PR c++/121351
            PR c++/119859

    gcc/cp/ChangeLog:

            * class.cc (add_method): Substitute outer template arguments
            into constraints before comparing them if the declarations are
            from different classes.

    gcc/testsuite/ChangeLog:

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

    Reviewed-by: Jason Merrill <ja...@redhat.com>
    (cherry picked from commit b9f1cc4e119da9205cb8438f0132c62a19afe4ae)

Reply via email to