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

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

https://gcc.gnu.org/g:2902f2d8424cfa365fec49401fa066e2b6de9ca4

commit r11-8732-g2902f2d8424cfa365fec49401fa066e2b6de9ca4
Author: Patrick Palka <ppa...@redhat.com>
Date:   Fri Jul 2 13:54:57 2021 -0400

    c++: unqualified member template in constraint [PR101247]

    Here any_template_parm_r is failing to mark the template parameters
    implicitly used by the unqualified use of 'd' inside the constraint
    because the code to do so assumes each level of a template parameter
    list points to the corresponding primary template, but here the
    parameter level for A in the out-of-line definition of A::B does not
    (nor do the parameter levels for A and C in the definition of A::C),
    which causes us to overlook the sharing.

    So it seems we can't in general depend on the TREE_TYPE of a template
    parameter level being non-empty here.  This patch partially fixes this
    by rewriting the relevant part of any_template_parm_r to not depend on
    the TREE_TYPE of outer levels.  We still depend on the innermost level
    to point to the innermost primary template, so we still crash on the
    commented out line in the below testcase.

            PR c++/101247

    gcc/cp/ChangeLog:

            * pt.c (any_template_parm_r) <case TEMPLATE_DECL>: Rewrite to
            use common_enclosing_class and to not depend on the TREE_TYPE
            of outer levels pointing to the corresponding primary template.

    gcc/testsuite/ChangeLog:

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

    (cherry picked from commit e3528ce197f8886869f95e8a8f901861a319851c)

Reply via email to