https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84182
Bug ID: 84182 Summary: [8 Regression] ICE in variadic lambda inside a template when calling a captured lambda Product: gcc Version: 8.0.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: benni.buch at gmail dot com Target Milestone: --- template < typename ... T > void sink(T ...){} template < typename > void f(){ auto const lambda = [](int){ return 1; }; [lambda](auto ... i){ sink(lambda(i) ...); }(1); } int main(){ f< int >(); } $ g++ -std=c++14 main.cpp main.cpp: In instantiation of 'f() [with <template-parameter-1-1> = int]::<lambda(auto:1 ...)> [with auto:1 = {int}]': main.cpp:9:6: required from 'void f() [with <template-parameter-1-1> = int]' main.cpp:13:14: required from here main.cpp:7:24: internal compiler error: in lookup_template_class_1, at cp/pt.c:8957 [lambda](auto ... i){ ^ 0x612f6a lookup_template_class_1 ../../gcc/gcc/cp/pt.c:8957 0x612f6a lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*, int, int) ../../gcc/gcc/cp/pt.c:9167 0x940d5a tsubst_aggr_type ../../gcc/gcc/cp/pt.c:12073 0x93873f tsubst_copy ../../gcc/gcc/cp/pt.c:14845 0x92711d tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) ../../gcc/gcc/cp/pt.c:18059 0x93a8e4 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) ../../gcc/gcc/cp/pt.c:14365 0x93a8e4 tsubst(tree_node*, tree_node*, int, tree_node*) ../../gcc/gcc/cp/pt.c:14365 0x941873 tsubst_decl ../../gcc/gcc/cp/pt.c:13111 0x939eef tsubst_copy ../../gcc/gcc/cp/pt.c:14890 0x925ee0 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) ../../gcc/gcc/cp/pt.c:18266 0x9275de tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) ../../gcc/gcc/cp/pt.c:17663 0x934e49 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) ../../gcc/gcc/cp/pt.c:17100 0x934e49 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) ../../gcc/gcc/cp/pt.c:16838 0x9436b2 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) ../../gcc/gcc/cp/pt.c:16030 0x9436b2 gen_elem_of_pack_expansion_instantiation ../../gcc/gcc/cp/pt.c:11175 0x9436b2 tsubst_pack_expansion(tree_node*, tree_node*, int, tree_node*) ../../gcc/gcc/cp/pt.c:11683 0x927ded tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) ../../gcc/gcc/cp/pt.c:17684 0x934e49 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) ../../gcc/gcc/cp/pt.c:17100 0x934e49 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) ../../gcc/gcc/cp/pt.c:16838 0x933970 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) ../../gcc/gcc/cp/pt.c:16059 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions. $ g++ --version g++ (GCC) 8.0.1 20180202 (experimental) Copyright (C) 2018 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Known to work with GCC 6.3 and 5.4: $ g++-6 --version g++-6 (Ubuntu/Linaro 6.3.0-18ubuntu2~16.04) 6.3.0 20170519 Copyright (C) 2016 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $ g++-5 --version g++-5 (Ubuntu 5.4.1-2ubuntu1~16.04) 5.4.1 20160904 Copyright (C) 2015 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.