[Bug c++/96917] decltype(auto) variable initialized with lambda by-reference capture has incorrect type
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Nov 10 15:58:16 GMT 2023
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96917
--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>:
https://gcc.gnu.org/g:705ab7927c81b77503d229513fac991106617766
commit r14-5330-g705ab7927c81b77503d229513fac991106617766
Author: Patrick Palka <ppalka@redhat.com>
Date: Fri Nov 10 10:58:04 2023 -0500
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>
More information about the Gcc-bugs
mailing list