diff options
author | Patrick Palka <ppalka@redhat.com> | 2021-07-14 15:37:30 -0400 |
---|---|---|
committer | Patrick Palka <ppalka@redhat.com> | 2021-07-14 15:37:30 -0400 |
commit | bebd8e9da838c51a7f911985083d5a2b2498a23a (patch) | |
tree | 1f1fa33ea953166342a0ca303c3b0fa75c3ea7df /gcc/cfgexpand.c | |
parent | 91bb571d200e551f427e337e00494e0b4f229876 (diff) | |
download | gcc-bebd8e9da838c51a7f911985083d5a2b2498a23a.zip gcc-bebd8e9da838c51a7f911985083d5a2b2498a23a.tar.gz gcc-bebd8e9da838c51a7f911985083d5a2b2498a23a.tar.bz2 |
c++: CTAD and forwarding references [PR88252]
Here during CTAD we're incorrectly treating T&& as a forwarding
reference even though T is a template parameter of the class template.
This happens because the template parameter T in the out-of-line
definition of the constructor doesn't have the flag
TEMPLATE_TYPE_PARM_FOR_CLASS set, and during duplicate_decls the
the redeclaration (which is in terms of this unflagged T) prevails.
To fix this, we could perhaps be more consistent about setting the flag,
but it appears we don't really need this flag to make the determination.
Since the template parameters of an synthesized guide consist of the
template parameters of the class template followed by those of the
constructor (if any), it should suffice to look at the index of the
template parameter to determine whether it comes from the class
template or the constructor (template). This patch replaces the
TEMPLATE_TYPE_PARM_FOR_CLASS flag with this approach.
PR c++/88252
gcc/cp/ChangeLog:
* cp-tree.h (TEMPLATE_TYPE_PARM_FOR_CLASS): Remove.
* pt.c (push_template_decl): Remove TEMPLATE_TYPE_PARM_FOR_CLASS
handling.
(redeclare_class_template): Likewise.
(forwarding_reference_p): Define.
(maybe_adjust_types_for_deduction): Use it instead. Add 'tparms'
parameter.
(unify_one_argument): Pass tparms to
maybe_adjust_types_for_deduction.
(try_one_overload): Likewise.
(unify): Likewise.
(rewrite_template_parm): Remove TEMPLATE_TYPE_PARM_FOR_CLASS
handling.
gcc/testsuite/ChangeLog:
* g++.dg/cpp1z/class-deduction96.C: New test.
Diffstat (limited to 'gcc/cfgexpand.c')
0 files changed, 0 insertions, 0 deletions