https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79533
Bug ID: 79533 Summary: ICE in build_over_call under -std=c++17 in 'S s(static_cast<S const &>(f()));' Product: gcc Version: 7.0.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: sbergman at redhat dot com Target Milestone: --- At least with a recent GCC trunk build: > $ g++ --version > g++ (GCC) 7.0.1 20170214 (experimental) > Copyright (C) 2017 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 test.cc > struct S {}; > S f(); > S s(static_cast<S const &>(f())); > > $ g++ -std=c++17 -fsyntax-only test.cc > test.cc:3:32: internal compiler error: in build_over_call, at cp/call.c:7978 > S s(static_cast<S const &>(f())); > ^ > 0x5c34ec build_over_call > ../../src/gcc/cp/call.c:7975 > 0x5c443e build_new_method_call_1 > ../../src/gcc/cp/call.c:8801 > 0x5c443e build_new_method_call(tree_node*, tree_node*, vec<tree_node*, va_gc, > vl_embed>**, tree_node*, int, tree_node**, int) > ../../src/gcc/cp/call.c:8870 > 0x5c58c9 build_special_member_call(tree_node*, tree_node*, vec<tree_node*, > va_gc, vl_embed>**, tree_node*, int, int) > ../../src/gcc/cp/call.c:8399 > 0x74dfe4 expand_default_init > ../../src/gcc/cp/init.c:1790 > 0x74dfe4 expand_aggr_init_1 > ../../src/gcc/cp/init.c:1905 > 0x74ebeb build_aggr_init(tree_node*, tree_node*, int, int) > ../../src/gcc/cp/init.c:1643 > 0x5e05df build_aggr_init_full_exprs > ../../src/gcc/cp/decl.c:6164 > 0x5e05df check_initializer > ../../src/gcc/cp/decl.c:6312 > 0x60aabc cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int) > ../../src/gcc/cp/decl.c:7025 > 0x7090a3 cp_parser_init_declarator > ../../src/gcc/cp/parser.c:19389 > 0x709a6c cp_parser_simple_declaration > ../../src/gcc/cp/parser.c:12792 > 0x70a825 cp_parser_block_declaration > ../../src/gcc/cp/parser.c:12617 > 0x6e33d4 cp_parser_declaration > ../../src/gcc/cp/parser.c:12515 > 0x713e6b cp_parser_declaration_seq_opt > ../../src/gcc/cp/parser.c:12391 > 0x71414a cp_parser_translation_unit > ../../src/gcc/cp/parser.c:4366 > 0x71414a c_parse_file() > ../../src/gcc/cp/parser.c:38425 > 0x873ac3 c_common_parse_file() > ../../src/gcc/c-family/c-opts.c:1107 > Please submit a full bug report, > with preprocessed source if appropriate. > Please include the complete backtrace with any bug report. > See <https://gcc.gnu.org/bugs/> for instructions. The ICE happens with -std=c++17/-std=gnu++17, doesn't happen with -std=c++14 etc. I cannot reproduce it with g++ from gcc-c++-6.3.1-1.fc25.x86_64, but maybe that one's built without assertions.