This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/71837] New: ICE on valid C++14 code with initialized lambda capture: in tsubst_pack_expansion, at cp/pt.c:10905
- From: "su at cs dot ucdavis.edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 11 Jul 2016 07:06:09 +0000
- Subject: [Bug c++/71837] New: ICE on valid C++14 code with initialized lambda capture: in tsubst_pack_expansion, at cp/pt.c:10905
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71837
Bug ID: 71837
Summary: ICE on valid C++14 code with initialized lambda
capture: in tsubst_pack_expansion, at cp/pt.c:10905
Product: gcc
Version: 7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: su at cs dot ucdavis.edu
Target Milestone: ---
The following C++14 code causes an ICE when compiled with the current GCC trunk
on x86_64-linux-gnu in both 32-bit and 64-bit modes.
It also affects at least 4.9.x, 5.x and 6.x.
The code is accepted by both Clang and MSVC.
$ g++-trunk -v
Using built-in specs.
COLLECT_GCC=g++-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20160711 (experimental) [trunk revision 238202] (GCC)
$
$ clang++-3.8 -c -std=c++14 small.cpp
$
$ g++-trunk -c -std=c++14 small.cpp
small.cpp: In instantiation of ‘struct f(Ts ...) [with Ts = {int}]::<lambda>’:
small.cpp:3:22: required from ‘void f(Ts ...) [with Ts = {int}]’
small.cpp:8:7: required from here
small.cpp:3:16: error: invalid use of pack expansion expression
[ts (args ...)] {} ();
^
small.cpp:3:16: internal compiler error: in tsubst_pack_expansion, at
cp/pt.c:10905
0x6f7d64 tsubst_pack_expansion(tree_node*, tree_node*, int, tree_node*)
../../gcc-source-trunk/gcc/cp/pt.c:10905
0x6e4920 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../gcc-source-trunk/gcc/cp/pt.c:16780
0x71da10 instantiate_class_template_1
../../gcc-source-trunk/gcc/cp/pt.c:10359
0x71da10 instantiate_class_template(tree_node*)
../../gcc-source-trunk/gcc/cp/pt.c:10417
0x7c0973 complete_type(tree_node*)
../../gcc-source-trunk/gcc/cp/typeck.c:133
0x6e243c tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../gcc-source-trunk/gcc/cp/pt.c:17194
0x6e48aa tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../gcc-source-trunk/gcc/cp/pt.c:16536
0x6d6cbf tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc-source-trunk/gcc/cp/pt.c:15868
0x6d735a tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc-source-trunk/gcc/cp/pt.c:15180
0x6d66b3 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc-source-trunk/gcc/cp/pt.c:15166
0x6d81f0 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc-source-trunk/gcc/cp/pt.c:15351
0x6d4bf5 instantiate_decl(tree_node*, int, bool)
../../gcc-source-trunk/gcc/cp/pt.c:22095
0x7218d2 instantiate_pending_templates(int)
../../gcc-source-trunk/gcc/cp/pt.c:22214
0x764a05 c_parse_final_cleanups()
../../gcc-source-trunk/gcc/cp/decl2.c:4600
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$
----------------------------------------------------
template < typename ... Ts > void f (Ts ... args)
{
[ts (args ...)] {} ();
}
int main ()
{
f (0);
return 0;
}