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

--- Comment #3 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:d3b0dc686c00bfe9e7f4fe0490def68e9b92157a

commit r12-7633-gd3b0dc686c00bfe9e7f4fe0490def68e9b92157a
Author: Patrick Palka <ppa...@redhat.com>
Date:   Sat Mar 12 15:00:51 2022 -0500

    c++: naming a dependently-scoped template for CTAD [PR104641]

    In order to be able to perform CTAD for a dependently-scoped template
    (such as A<T>::B in the testcase below), we need to permit a
    typename-specifier to resolve to a template as per [dcl.type.simple]/3,
    at least when it appears in a CTAD-enabled context.

    This patch implements this using a new tsubst flag tf_tst_ok to control
    when a TYPENAME_TYPE is allowed to name a template, and sets this flag
    when substituting into the type of a CAST_EXPR, CONSTRUCTOR or VAR_DECL
    (each of which is a CTAD-enabled context).

            PR c++/104641

    gcc/cp/ChangeLog:

            * cp-tree.h (tsubst_flags::tf_tst_ok): New flag.
            * decl.cc (make_typename_type): Allow a typename-specifier to
            resolve to a template when tf_tst_ok, in which case return
            a CTAD placeholder for the template.
            * pt.cc (tsubst_decl) <case VAR_DECL>: Set tf_tst_ok when
            substituting the type.
            (tsubst): Clear tf_tst_ok and remember if it was set.
            <case TYPENAME_TYPE>: Pass tf_tst_ok to make_typename_type
            appropriately.
            (tsubst_copy) <case CAST_EXPR>: Set tf_tst_ok when substituting
            the type.
            (tsubst_copy_and_build) <case CAST_EXPR>: Likewise.
            <case CONSTRUCTOR>: Likewise.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp1z/class-deduction107.C: New test.

Reply via email to