diff options
author | Patrick Palka <ppalka@redhat.com> | 2022-03-12 15:00:51 -0500 |
---|---|---|
committer | Patrick Palka <ppalka@redhat.com> | 2022-03-12 15:00:51 -0500 |
commit | d3b0dc686c00bfe9e7f4fe0490def68e9b92157a (patch) | |
tree | 28075dfe71b0a509f6b46e681ec9971663da8b15 /libobjc | |
parent | 03c83cf7aa1110e427beb00ea95767dfaf50d694 (diff) | |
download | gcc-d3b0dc686c00bfe9e7f4fe0490def68e9b92157a.zip gcc-d3b0dc686c00bfe9e7f4fe0490def68e9b92157a.tar.gz gcc-d3b0dc686c00bfe9e7f4fe0490def68e9b92157a.tar.bz2 |
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.
Diffstat (limited to 'libobjc')
0 files changed, 0 insertions, 0 deletions