]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: decltype of capture proxy [PR79378, PR96917]
authorPatrick Palka <ppalka@redhat.com>
Fri, 10 Nov 2023 15:58:04 +0000 (10:58 -0500)
committerPatrick Palka <ppalka@redhat.com>
Fri, 10 Nov 2023 15:58:04 +0000 (10:58 -0500)
commit705ab7927c81b77503d229513fac991106617766
tree66c2ef60abeb65d30e3fba18c7aa768251ca4694
parent5dbaf4851bbf56b6176dca1f1e7d38a16b5b84ee
c++: decltype of capture proxy [PR79378, PR96917]

We typically don't see capture proxies in finish_decltype_type because
process_outer_var_ref is a no-op within an unevaluated context and so a
use of a captured variable within decltype resolves to the captured
variable, not the capture.  But we can see them during decltype(auto)
deduction and for decltype of an init-capture, which suggests we need to
handle capture proxies specially within finish_decltype_type after all.
This patch adds such handling.

PR c++/79378
PR c++/96917

gcc/cp/ChangeLog:

* semantics.cc (finish_decltype_type): Handle an id-expression
naming a capture proxy specially.

gcc/testsuite/ChangeLog:

* g++.dg/cpp1y/decltype-auto7.C: New test.
* g++.dg/cpp1y/lambda-init20.C: New test.

Reviewed-by: Jason Merrill <jason@redhat.com>
gcc/cp/semantics.cc
gcc/testsuite/g++.dg/cpp1y/decltype-auto7.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1y/lambda-init20.C [new file with mode: 0644]