https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67846
Bug ID: 67846 Summary: ICE on code with lambda expression on x86_64-linux-gnu in check_return_expr, at cp/typeck.c:8609 Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: su at cs dot ucdavis.edu Target Milestone: --- The following code causes an ICE when compiled with the current gcc trunk on x86_64-linux-gnu. $ g++-trunk -v Using built-in specs. COLLECT_GCC=g++-trunk COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/6.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../gcc-trunk/configure --prefix=/usr/local/gcc-trunk --enable-languages=c,c++ --disable-werror --enable-multilib Thread model: posix gcc version 6.0.0 20151004 (experimental) [trunk revision 228457] (GCC) $ $ g++-trunk -c small.cc small.cc: In lambda function: small.cc:5:23: error: invalid use of member function (did you forget the ‘()’ ?) [=] { return foo; }; ^ small.cc:5:23: internal compiler error: in check_return_expr, at cp/typeck.c:8609 0x723c8d check_return_expr(tree_node*, bool*) ../../gcc-trunk/gcc/cp/typeck.c:8609 0x7610be finish_return_stmt(tree_node*) ../../gcc-trunk/gcc/cp/semantics.c:873 0x705e44 cp_parser_lambda_body ../../gcc-trunk/gcc/cp/parser.c:9855 0x705e44 cp_parser_lambda_expression ../../gcc-trunk/gcc/cp/parser.c:9360 0x6d92b7 cp_parser_primary_expression ../../gcc-trunk/gcc/cp/parser.c:4713 0x6e410b cp_parser_postfix_expression ../../gcc-trunk/gcc/cp/parser.c:6404 0x6e4c99 cp_parser_unary_expression ../../gcc-trunk/gcc/cp/parser.c:7689 0x6e58d7 cp_parser_binary_expression ../../gcc-trunk/gcc/cp/parser.c:8442 0x6e5fdf cp_parser_assignment_expression ../../gcc-trunk/gcc/cp/parser.c:8700 0x6e89f1 cp_parser_expression ../../gcc-trunk/gcc/cp/parser.c:8854 0x6e9cb6 cp_parser_expression_statement ../../gcc-trunk/gcc/cp/parser.c:10270 0x6ff07a cp_parser_statement ../../gcc-trunk/gcc/cp/parser.c:10121 0x6ffee9 cp_parser_statement_seq_opt ../../gcc-trunk/gcc/cp/parser.c:10393 0x70004b cp_parser_compound_statement ../../gcc-trunk/gcc/cp/parser.c:10347 0x70025b cp_parser_function_body ../../gcc-trunk/gcc/cp/parser.c:20112 0x70025b cp_parser_ctor_initializer_opt_and_function_body ../../gcc-trunk/gcc/cp/parser.c:20148 0x7010f9 cp_parser_function_definition_after_declarator ../../gcc-trunk/gcc/cp/parser.c:24755 0x704cdc cp_parser_late_parsing_for_member ../../gcc-trunk/gcc/cp/parser.c:25559 0x6e0199 cp_parser_class_specifier_1 ../../gcc-trunk/gcc/cp/parser.c:20972 0x6e0199 cp_parser_class_specifier ../../gcc-trunk/gcc/cp/parser.c:20998 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <http://gcc.gnu.org/bugs.html> for instructions. $ -------------------------- class A { void foo () { [=] { return foo; }; } };