https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85028
Bug ID: 85028 Summary: ICE on invalid C++ code: in tsubst_default_argument, at cp/pt.c:12340 Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: su at cs dot ucdavis.edu Target Milestone: --- It appears to be a recent regression. $ g++tk -v Using built-in specs. COLLECT_GCC=g++tk COLLECT_LTO_WRAPPER=/home/su/software/tmp/gcc/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/8.0.1/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto --prefix=/home/su/software/tmp/gcc/gcc-trunk --disable-bootstrap Thread model: posix gcc version 8.0.1 20180321 (experimental) [trunk revision 258722] (GCC) $ $ g++tk tmp.cpp tmp.cpp:7:11: error: ‘<anonymous>’ has incomplete type B (int, A = A()) : f (0) {} ^~~~~~~ tmp.cpp:3:8: note: forward declaration of ‘struct A’ struct A; ^ tmp.cpp:11:15: internal compiler error: in tsubst_default_argument, at cp/pt.c:12340 B < int > b (0); ^ 0x8676bf tsubst_default_argument(tree_node*, int, tree_node*, tree_node*, int) ../../gcc-source-trunk/gcc/cp/pt.c:12340 0x6c9907 convert_default_arg(tree_node*, tree_node*, tree_node*, int, int) ../../gcc-source-trunk/gcc/cp/call.c:7347 0x6ca4d8 build_over_call ../../gcc-source-trunk/gcc/cp/call.c:7974 0x6d8bfc build_new_method_call_1 ../../gcc-source-trunk/gcc/cp/call.c:9343 0x6d8bfc build_new_method_call(tree_node*, tree_node*, vec<tree_node*, va_gc, vl_embed>**, tree_node*, int, tree_node**, int) ../../gcc-source-trunk/gcc/cp/call.c:9419 0x6d9d43 build_special_member_call(tree_node*, tree_node*, vec<tree_node*, va_gc, vl_embed>**, tree_node*, int, int) ../../gcc-source-trunk/gcc/cp/call.c:8949 0x7b55f0 expand_default_init ../../gcc-source-trunk/gcc/cp/init.c:1893 0x7b55f0 expand_aggr_init_1 ../../gcc-source-trunk/gcc/cp/init.c:2007 0x7b63e4 build_aggr_init(tree_node*, tree_node*, int, int) ../../gcc-source-trunk/gcc/cp/init.c:1748 0x752d6c build_aggr_init_full_exprs ../../gcc-source-trunk/gcc/cp/decl.c:6271 0x752d6c check_initializer ../../gcc-source-trunk/gcc/cp/decl.c:6420 0x77b369 cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int) ../../gcc-source-trunk/gcc/cp/decl.c:7125 0x8384fd cp_parser_init_declarator ../../gcc-source-trunk/gcc/cp/parser.c:19740 0x83a1bf cp_parser_simple_declaration ../../gcc-source-trunk/gcc/cp/parser.c:13065 0x83b108 cp_parser_block_declaration ../../gcc-source-trunk/gcc/cp/parser.c:12883 0x847034 cp_parser_declaration ../../gcc-source-trunk/gcc/cp/parser.c:12780 0x8459b6 cp_parser_declaration_seq_opt ../../gcc-source-trunk/gcc/cp/parser.c:12656 0x845cd3 cp_parser_translation_unit ../../gcc-source-trunk/gcc/cp/parser.c:4561 0x845cd3 c_parse_file() ../../gcc-source-trunk/gcc/cp/parser.c:39017 0x98fe15 c_common_parse_file() ../../gcc-source-trunk/gcc/c-family/c-opts.c:1132 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. $ --------------------------------- // should have been: // struct A {}; struct A; template < typename > struct B { B (int, A = A()) : f (0) {} int f; }; B < int > b (0);