[Bug c++/94483] [9/10 Regression] ICE: tree check: expected type_pack_expansion, have error_mark in add_capture, at cp/lambda.c:607
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Apr 17 18:08:04 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94483
--- 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:a28edad3da5c59f09565d3d42e20be1a924986c4
commit r10-7780-ga28edad3da5c59f09565d3d42e20be1a924986c4
Author: Patrick Palka <ppalka@redhat.com>
Date: Thu Apr 16 10:28:23 2020 -0400
c++: Non-type-dependent variadic lambda init-capture [PR94483]
In this PR, we're ICEing on a use of an 'int... a' template parameter pack
as
part of the variadic lambda init-capture [...z=a].
The unexpected thing about this variadic init-capture is that it is not
type-dependent, and so the call to do_auto_deduction from
lambda_capture_field_type actually resolves its type to 'int' instead of
exiting
early like it does for a type-dependent variadic initializer. This later
confuses add_capture which, according to one of its comments, assumes that
'type' is always 'auto' for a variadic init-capture.
The simplest fix (and the approach that this patch takes) seems to be to
avoid
doing auto deduction in lambda_capture_field_type when the initializer uses
parameter packs, so that we always return 'auto' even in the
non-type-dependent
case.
gcc/cp/ChangeLog:
PR c++/94483
* lambda.c (lambda_capture_field_type): Avoid doing auto deduction
if
the explicit initializer has parameter packs.
gcc/testsuite/ChangeLog:
PR c++/94483
* g++.dg/cpp2a/lambda-pack-init5.C: New test.
More information about the Gcc-bugs
mailing list