https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68509
Bug ID: 68509 Summary: [6 regression][C++1z] ICE: in 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: lucdanton at free dot fr Target Milestone: --- Testcase compiles fine in C++11 and C++14 modes, ICE is in C++1z mode only. $ g++-trunk --version g++-trunk (GCC) 6.0.0 20151124 (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. $ cat main.cpp constexpr auto foo(int i) { if(i == 0) { return 0; } else { return 'a'; } } int main() { using X = decltype( foo(0) ); return X {}; } $ g++-trunk -std=c++1z main.cpp main.cpp: In function 'constexpr auto foo(int)': main.cpp:6:16: internal compiler error: in check_return_expr, at cp/typeck.c:8635 return 'a'; ^~~ 0x66f5b3 check_return_expr(tree_node*, bool*) ../../gcc/gcc/cp/typeck.c:8635 0x68fa5e finish_return_stmt(tree_node*) ../../gcc/gcc/cp/semantics.c:867 0x6584e8 cp_parser_jump_statement ../../gcc/gcc/cp/parser.c:11414 0x6584e8 cp_parser_statement ../../gcc/gcc/cp/parser.c:10035 0x658bac cp_parser_statement_seq_opt ../../gcc/gcc/cp/parser.c:10426 0x658ce6 cp_parser_compound_statement ../../gcc/gcc/cp/parser.c:10380 0x65fb0c cp_parser_implicitly_scoped_statement ../../gcc/gcc/cp/parser.c:11520 0x658a01 cp_parser_selection_statement ../../gcc/gcc/cp/parser.c:10555 0x658a01 cp_parser_statement ../../gcc/gcc/cp/parser.c:10010 0x658bac cp_parser_statement_seq_opt ../../gcc/gcc/cp/parser.c:10426 0x658ce6 cp_parser_compound_statement ../../gcc/gcc/cp/parser.c:10380 0x658e3b cp_parser_function_body ../../gcc/gcc/cp/parser.c:20192 0x658e3b cp_parser_ctor_initializer_opt_and_function_body ../../gcc/gcc/cp/parser.c:20228 0x6599e8 cp_parser_function_definition_after_declarator ../../gcc/gcc/cp/parser.c:24836 0x65a93f cp_parser_function_definition_from_specifiers_and_declarator ../../gcc/gcc/cp/parser.c:24748 0x65a93f cp_parser_init_declarator ../../gcc/gcc/cp/parser.c:17972 0x65ac3d cp_parser_simple_declaration ../../gcc/gcc/cp/parser.c:11980 0x65b0d3 cp_parser_block_declaration ../../gcc/gcc/cp/parser.c:11854 0x662d35 cp_parser_declaration ../../gcc/gcc/cp/parser.c:11751 0x661328 cp_parser_declaration_seq_opt ../../gcc/gcc/cp/parser.c:11630 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.