https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68597
Bug ID: 68597 Summary: ice inin check_return_expr, at cp/typeck.c:8635 Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: ryan.burn at gmail dot com Target Milestone: --- Below code causes this stack trace when compiled with -std=c++1z when compiled with rnburn@localhost ~/bugs/lambda_check_return $ g++17 --version g++ (GCC) 6.0.0 20151123 (experimental) Copyright (C) 2015 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. main.cpp: In lambda function: main.cpp:19:35: internal compiler error: in check_return_expr, at cp/typeck.c:8635 return 1 / beta * (alpha - 1); ^ 0x75f9dd check_return_expr(tree_node*, bool*) ../../src-fix/gcc/cp/typeck.c:8635 0x79bfae finish_return_stmt(tree_node*) ../../src-fix/gcc/cp/semantics.c:867 0x73a6dd cp_parser_jump_statement ../../src-fix/gcc/cp/parser.c:11414 0x73a6dd cp_parser_statement ../../src-fix/gcc/cp/parser.c:10035 0x74239f cp_parser_implicitly_scoped_statement ../../src-fix/gcc/cp/parser.c:11527 0x73aab1 cp_parser_selection_statement ../../src-fix/gcc/cp/parser.c:10555 0x73aab1 cp_parser_statement ../../src-fix/gcc/cp/parser.c:10010 0x74239f cp_parser_implicitly_scoped_statement ../../src-fix/gcc/cp/parser.c:11527 0x73aab1 cp_parser_selection_statement ../../src-fix/gcc/cp/parser.c:10555 0x73aab1 cp_parser_statement ../../src-fix/gcc/cp/parser.c:10010 0x73ae41 cp_parser_statement_seq_opt ../../src-fix/gcc/cp/parser.c:10426 0x741662 cp_parser_lambda_body ../../src-fix/gcc/cp/parser.c:9894 0x741662 cp_parser_lambda_expression ../../src-fix/gcc/cp/parser.c:9378 0x70f887 cp_parser_primary_expression ../../src-fix/gcc/cp/parser.c:4753 0x71b523 cp_parser_postfix_expression ../../src-fix/gcc/cp/parser.c:6444 0x7199f9 cp_parser_unary_expression ../../src-fix/gcc/cp/parser.c:7688 0x724059 cp_parser_binary_expression ../../src-fix/gcc/cp/parser.c:8441 0x7248bf cp_parser_assignment_expression ../../src-fix/gcc/cp/parser.c:8712 0x724d35 cp_parser_constant_expression ../../src-fix/gcc/cp/parser.c:8964 0x73c4e7 cp_parser_init_declarator ../../src-fix/gcc/cp/parser.c:18147 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. ///////////////////////////////////////////////////////////////////// #include <cmath> auto make_test_objective3(double beta, double l, int& evaluation_counter) { auto phi0 = [=](double alpha) { if (alpha <= 1-beta) return 1-alpha; else if (alpha >= 1+beta) return alpha-1; else return 1 / (2*beta)*std::pow(alpha-1,2)+beta/2; }; auto phi0_prime = [=](double alpha) { if (alpha <= 1-beta) return -1; else if (alpha >= 1+beta) return 1; else return 1 / beta * (alpha - 1); }; } int main() { return 0; } /////////////////////////////////////////////////////////////////////