https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62272
Bug ID: 62272 Summary: Gimplify throws error on method call from inside nested lambdas Product: gcc Version: 4.9.1 Status: UNCONFIRMED Severity: major Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: aaron.plavnick at spottradingllc dot com Here is a minimal code sample, the bug exists in 4.7.3, 4.8.2, and 4.9.1. I compiled with -std=c++11 -------------------------------------------- template< typename T > class B { public: void Foo() {} void Bar() { [&]() { [&]() { Foo(); }(); }(); } }; int main( int argc, char** argv ) { B<int> b; b.Bar(); return 0; } ---------------------- The compiler returns: main.cpp: In lambda function: main.cpp:11:34: internal compiler error: in gimplify_var_or_parm_decl, at gimplify.c:1741 [&]() { Foo(); }(); ^ 0x81b03d gimplify_var_or_parm_decl ../../../../src/gcc-4.9.1/gcc/gimplify.c:1741 0x81d931 gimplify_expr(tree_node**, gimple_statement_base**, gimple_statement_base**, bool (*)(tree_node*), int) ../../../../src/gcc-4.9.1/gcc/gimplify.c:8058 0x81cb40 gimplify_modify_expr ../../../../src/gcc-4.9.1/gcc/gimplify.c:4527 0x81d97a gimplify_expr(tree_node**, gimple_statement_base**, gimple_statement_base**, bool (*)(tree_node*), int) ../../../../src/gcc-4.9.1/gcc/gimplify.c:7627 0x820876 gimplify_stmt(tree_node**, gimple_statement_base**) ../../../../src/gcc-4.9.1/gcc/gimplify.c:5373 0x820a3a gimplify_and_add ../../../../src/gcc-4.9.1/gcc/gimplify.c:385 0x820a3a gimplify_init_ctor_eval ../../../../src/gcc-4.9.1/gcc/gimplify.c:3558 0x81c0f2 gimplify_init_constructor ../../../../src/gcc-4.9.1/gcc/gimplify.c:3904 0x81c98e gimplify_modify_expr_rhs ../../../../src/gcc-4.9.1/gcc/gimplify.c:4167 0x81ca64 gimplify_modify_expr ../../../../src/gcc-4.9.1/gcc/gimplify.c:4486 0x81d97a gimplify_expr(tree_node**, gimple_statement_base**, gimple_statement_base**, bool (*)(tree_node*), int) ../../../../src/gcc-4.9.1/gcc/gimplify.c:7627 0x81da18 gimplify_target_expr ../../../../src/gcc-4.9.1/gcc/gimplify.c:5304 0x81da18 gimplify_expr(tree_node**, gimple_statement_base**, gimple_statement_base**, bool (*)(tree_node*), int) ../../../../src/gcc-4.9.1/gcc/gimplify.c:7994 0x81e4b3 gimplify_addr_expr ../../../../src/gcc-4.9.1/gcc/gimplify.c:4833 0x81e4b3 gimplify_expr(tree_node**, gimple_statement_base**, gimple_statement_base**, bool (*)(tree_node*), int) ../../../../src/gcc-4.9.1/gcc/gimplify.c:7673 0x8235ba gimplify_call_expr ../../../../src/gcc-4.9.1/gcc/gimplify.c:2395 0x81db82 gimplify_expr(tree_node**, gimple_statement_base**, gimple_statement_base**, bool (*)(tree_node*), int) ../../../../src/gcc-4.9.1/gcc/gimplify.c:7598 0x820876 gimplify_stmt(tree_node**, gimple_statement_base**) ../../../../src/gcc-4.9.1/gcc/gimplify.c:5373 0x81dc0a gimplify_cleanup_point_expr ../../../../src/gcc-4.9.1/gcc/gimplify.c:5149 0x81dc0a gimplify_expr(tree_node**, gimple_statement_base**, gimple_statement_base**, bool (*)(tree_node*), int) ../../../../src/gcc-4.9.1/gcc/gimplify.c:7990