http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58566
Bug ID: 58566 Summary: [c++0x] ICE with invalid expression in lambda body Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: reichelt at gcc dot gnu.org The following invalid code snippet (compiled with "-std=c++0x") triggers an ICE since GCC 4.8.0: ================================= struct A { int foo() { [this]{ return foo; }; } }; ================================= bug.cc: In lambda function: bug.cc:5:25: error: invalid use of member function (did you forget the '()' ?) [this]{ return foo; }; ^ bug.cc:5:25: internal compiler error: in check_return_expr, at cp/typeck.c:8159 0x64d09a check_return_expr(tree_node*, bool*) ../../gcc-4.8.0/gcc/cp/typeck.c:8159 0x68856e finish_return_stmt(tree_node*) ../../gcc-4.8.0/gcc/cp/semantics.c:782 0x61a92c cp_parser_lambda_body ../../gcc-4.8.0/gcc/cp/parser.c:8643 0x61a92c cp_parser_lambda_expression ../../gcc-4.8.0/gcc/cp/parser.c:8194 0x61a92c cp_parser_primary_expression ../../gcc-4.8.0/gcc/cp/parser.c:4085 0x61b82a cp_parser_postfix_expression ../../gcc-4.8.0/gcc/cp/parser.c:5629 0x61dd3a cp_parser_unary_expression ../../gcc-4.8.0/gcc/cp/parser.c:6685 0x61e8d7 cp_parser_binary_expression ../../gcc-4.8.0/gcc/cp/parser.c:7365 0x61ed65 cp_parser_assignment_expression ../../gcc-4.8.0/gcc/cp/parser.c:7590 0x620b82 cp_parser_expression ../../gcc-4.8.0/gcc/cp/parser.c:7741 0x62124a cp_parser_expression_statement ../../gcc-4.8.0/gcc/cp/parser.c:9021 0x6172e7 cp_parser_statement ../../gcc-4.8.0/gcc/cp/parser.c:8873 0x61856e cp_parser_statement_seq_opt ../../gcc-4.8.0/gcc/cp/parser.c:9139 0x6186b6 cp_parser_compound_statement ../../gcc-4.8.0/gcc/cp/parser.c:9093 0x6297e3 cp_parser_function_body ../../gcc-4.8.0/gcc/cp/parser.c:17680 0x6297e3 cp_parser_ctor_initializer_opt_and_function_body ../../gcc-4.8.0/gcc/cp/parser.c:17716 0x62a86f cp_parser_function_definition_after_declarator ../../gcc-4.8.0/gcc/cp/parser.c:21691 0x6112dc cp_parser_late_parsing_for_member ../../gcc-4.8.0/gcc/cp/parser.c:22332 0x6112dc cp_parser_class_specifier_1 ../../gcc-4.8.0/gcc/cp/parser.c:18439 0x6112dc cp_parser_class_specifier ../../gcc-4.8.0/gcc/cp/parser.c:18463 Please submit a full bug report, [etc.]