diff options
author | Patrick Palka <ppalka@redhat.com> | 2024-03-01 12:50:18 -0500 |
---|---|---|
committer | Patrick Palka <ppalka@redhat.com> | 2024-03-01 12:50:18 -0500 |
commit | a6a1920b592b58c38137c5c891b3bbb02b084f38 (patch) | |
tree | 615cf08dc9ce23225989d29031de2eb40988da9b /gcc/tree-vect-loop.cc | |
parent | 4894c82b0c3cf0d6ec4bc1e96709b6140ec11f6e (diff) | |
download | gcc-a6a1920b592b58c38137c5c891b3bbb02b084f38.zip gcc-a6a1920b592b58c38137c5c891b3bbb02b084f38.tar.gz gcc-a6a1920b592b58c38137c5c891b3bbb02b084f38.tar.bz2 |
c++: auto(x) partial substitution [PR110025, PR114138]
In r12-6773-g09845ad7569bac we gave CTAD placeholders a level of 0 and
ensured we never replaced them via tsubst. It turns out that autos
representing an explicit cast need the same treatment and for the same
reason: such autos appear in an expression context and so their level
gets easily messed up after partial substitution, leading to premature
replacement via an incidental tsubst instead of via do_auto_deduction.
This patch fixes this by extending the r12-6773 approach to auto(x).
PR c++/110025
PR c++/114138
gcc/cp/ChangeLog:
* cp-tree.h (make_cast_auto): Declare.
* parser.cc (cp_parser_functional_cast): If the type is an auto,
replace it with a level-less one via make_cast_auto.
* pt.cc (find_parameter_packs_r): Don't treat level-less auto
as a type parameter pack.
(tsubst) <case TEMPLATE_TYPE_PARM>: Generalize CTAD placeholder
auto handling to all level-less autos.
(make_cast_auto): Define.
(do_auto_deduction): Handle replacement of a level-less auto.
gcc/testsuite/ChangeLog:
* g++.dg/cpp23/auto-fncast16.C: New test.
* g++.dg/cpp23/auto-fncast17.C: New test.
* g++.dg/cpp23/auto-fncast18.C: New test.
Reviewed-by: Jason Merrill <jason@redhat.com>
Diffstat (limited to 'gcc/tree-vect-loop.cc')
0 files changed, 0 insertions, 0 deletions