https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84126
Bug ID: 84126 Summary: [8 Regression] ICE in variadic generic lambda inside a template function calling a function with arguments by reference 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 bar(T&){} // ICE with reference, work with just T template <typename T > void foo(T){ [](auto ... k){ (bar(k), ...); }(0); } int main() { foo(0); } $ g++ -std=c++17 equal.cpp during RTL pass: expand equal.cpp: In lambda function: equal.cpp:7:13: internal compiler error: in make_decl_rtl, at varasm.c:1315 (bar(k), ...); ~~~^~~ 0x76ba10 make_decl_rtl(tree_node*) ../../gcc/gcc/varasm.c:1314 0xb7bb9d expand_expr_real_1(tree_node*, rtx_def*, machine_mode, expand_modifier, rtx_def**, bool) ../../gcc/gcc/expr.c:9958 0xb856be expand_expr ../../gcc/gcc/expr.h:276 0xb856be expand_expr_addr_expr_1 ../../gcc/gcc/expr.c:7939 0xb79fe4 expand_expr_addr_expr ../../gcc/gcc/expr.c:8060 0xb79fe4 expand_expr_real_1(tree_node*, rtx_def*, machine_mode, expand_modifier, rtx_def**, bool) ../../gcc/gcc/expr.c:11220 0xa6297f expand_normal ../../gcc/gcc/expr.h:282 0xa6297f precompute_register_parameters ../../gcc/gcc/calls.c:987 0xa6297f expand_call(tree_node*, rtx_def*, int) ../../gcc/gcc/calls.c:3977 0xb79dc5 expand_expr_real_1(tree_node*, rtx_def*, machine_mode, expand_modifier, rtx_def**, bool) ../../gcc/gcc/expr.c:10992 0xa7518e expand_expr ../../gcc/gcc/expr.h:276 0xa7518e expand_call_stmt ../../gcc/gcc/cfgexpand.c:2690 0xa7518e expand_gimple_stmt_1 ../../gcc/gcc/cfgexpand.c:3624 0xa7518e expand_gimple_stmt ../../gcc/gcc/cfgexpand.c:3790 0xa761ff expand_gimple_basic_block ../../gcc/gcc/cfgexpand.c:5810 0xa7ad67 execute ../../gcc/gcc/cfgexpand.c:6416 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 20180130 (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. Boost.Hana test suite has some test cases that run into this! Known to work with GCC 6.3: $ 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.