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

--- Comment #1 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:ee50b4383a0dca88172c3a821418344bd7391956

commit r12-7134-gee50b4383a0dca88172c3a821418344bd7391956
Author: Patrick Palka <ppa...@redhat.com>
Date:   Wed Feb 9 11:33:04 2022 -0500

    c++: memfn lookup consistency and using-decls [PR104432]

    In filter_memfn_lookup, we weren't correctly recognizing and matching up
    member functions introduced via a non-dependent using-decl.  This caused
    us to crash in the below testcases in which we correctly pruned the
    overload set for the non-dependent call ahead of time, but then at
    instantiation time filter_memfn_lookup failed to match the selected
    function (introduced in each case by a non-dependent using-decl) to the
    corresponding function from the new lookup set.  Such member functions
    need special handling in filter_memfn_lookup because they look exactly
    the same in the old and new lookup sets, whereas ordinary member
    functions that're defined in the (dependent) current class become more
    specialized in the new lookup set.

    This patch reworks the matching logic in filter_memfn_lookup so that it
    handles (member functions introduced by) non-dependent using-decls
    correctly, and is hopefully simpler overall.

            PR c++/104432

    gcc/cp/ChangeLog:

            * call.cc (build_new_method_call): When a non-dependent call
            resolves to a specialization of a member template, always build
            the pruned overload set using the member template, not the
            specialization.
            * pt.cc (filter_memfn_lookup): New parameter newtype.  Simplify
            and correct how members from the new lookup set are matched to
            those from the old one.
            (tsubst_baselink): Pass binfo_type as newtype to
            filter_memfn_lookup.

    gcc/testsuite/ChangeLog:

            * g++.dg/template/non-dependent19.C: New test.
            * g++.dg/template/non-dependent19a.C: New test.
            * g++.dg/template/non-dependent20.C: New test.

Reply via email to