https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70100
--- Comment #3 from Jaak Ristioja <jaak at ristioja dot ee> --- (In reply to Markus Trippelsdorf from comment #1) > template <typename Cmd> struct K { > using CmdSP = std::D<typename Cmd::CommandType>; > template <typename... Args> void operator()(Args... args) { > using MakeFunc = CmdSP(...); > MakeFunc makeFuncs; > [=] { [=] { makeFuncs(args...); }; }; > } > }; ... > main.ii: In member function ‘void state::gen::K<Cmd>::operator()(Args ...) > [with Args = {int}; Cmd = Get]’: > main.ii:79:36: internal compiler error: in execute, at cfgexpand.c:6069 We hit a similar case in our proprietary production code, which compiled with -O2 resulted in a segmentation fault, but when compiled with -O0, resulted in this ICE. Here is a smaller test-case to trigger this ICE with -std=c++11 -O0: void b(int) {} template <typename ... Args> void f(Args && ... args) { [&] { [&] { b(args...); }; }; } int main() { f(2); } // gcc (Gentoo Hardened 5.4.0-r3 p1.3, pie-0.6.5) 5.4.0 Dunno, if it is relevant, but here is some of the <censored> disassembly output at proprietary crash site with -O2 (attempting to read 1 byte from address 0x0, according to Valgrind): 0x000000105aa024ab <+1643>: mov %rax,%rbx 0x000000105aa024ae <+1646>: movl $0x1,0x8(%rax) 0x000000105aa024b5 <+1653>: movl $0x1,0xc(%rax) 0x000000105aa024bc <+1660>: lea 0x2a7f35(%rip),%rax #<vtable for std::_Sp_counted_ptr_inplace<MyClass, std::allocator<MyClass>, (__gnu_cxx::_Lock_policy)2> => 0x000000105aa024c3 <+1667>: movzbl 0x0,%ecx