https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82025
Bug ID: 82025 Summary: ICE: in finish_expr_stmt, at cp/semantics.c:678 Product: gcc Version: 7.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: nsz at gcc dot gnu.org Target Milestone: --- following code fails with ice with gcc 7.2.1 and gcc 6.3.0 (works on gcc 8): constexpr int nlz(int x) { return __builtin_constant_p(x) ? 0 : 1; } struct A { constexpr A() { nlz(0); } }; constexpr A operator-(A x) { return x; } constexpr A bar() { constexpr A x; A y = -x; return y; } $ g++ -S bar.cpp bar.cpp: In function 'constexpr A bar()': bar.cpp:13:10: internal compiler error: in finish_expr_stmt, at cp/semantics.c:678 A y = -x; ^ 0x695d33 finish_expr_stmt(tree_node*) /S/gcc/cp/semantics.c:678 0x5c9e3f initialize_local_var /S/gcc/cp/decl.c:6612 0x5c9e3f cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int) /S/gcc/cp/decl.c:7173 0x65d60b cp_parser_init_declarator /S/gcc/cp/parser.c:19403 0x65dd97 cp_parser_simple_declaration /S/gcc/cp/parser.c:12786 0x65e97f cp_parser_block_declaration /S/gcc/cp/parser.c:12611 0x65f2a7 cp_parser_declaration_statement /S/gcc/cp/parser.c:12221 0x63fa27 cp_parser_statement /S/gcc/cp/parser.c:10708 0x640e8b cp_parser_statement_seq_opt /S/gcc/cp/parser.c:11040 0x640f4f cp_parser_compound_statement /S/gcc/cp/parser.c:10994 0x652b43 cp_parser_function_body /S/gcc/cp/parser.c:21455 0x652b43 cp_parser_ctor_initializer_opt_and_function_body /S/gcc/cp/parser.c:21493 0x6594a3 cp_parser_function_definition_after_declarator /S/gcc/cp/parser.c:26284 0x65da47 cp_parser_function_definition_from_specifiers_and_declarator /S/gcc/cp/parser.c:26196 0x65da47 cp_parser_init_declarator /S/gcc/cp/parser.c:19182 0x65dd97 cp_parser_simple_declaration /S/gcc/cp/parser.c:12786 0x65e97f cp_parser_block_declaration /S/gcc/cp/parser.c:12611 0x63c65b cp_parser_declaration /S/gcc/cp/parser.c:12509 0x662eb3 cp_parser_declaration_seq_opt /S/gcc/cp/parser.c:12385 0x6631e3 cp_parser_translation_unit /S/gcc/cp/parser.c:4368 Please submit a full bug report, with preprocessed source if appropriate.