https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85027
Bug ID: 85027 Summary: ICE on invalid C++ code: in instantiate_type, at cp/class.c:8062 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 seems to affect all versions since at least as early as 4.x. $ 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:3:18: internal compiler error: in instantiate_type, at cp/class.c:8062 int t = A::A ? : 0; ^ 0x6f4360 instantiate_type(tree_node*, tree_node*, int) ../../gcc-source-trunk/gcc/cp/class.c:8062 0x6cffea perform_implicit_conversion_flags(tree_node*, tree_node*, int, int) ../../gcc-source-trunk/gcc/cp/call.c:10628 0x6dfc83 build_conditional_expr_1 ../../gcc-source-trunk/gcc/cp/call.c:4962 0x6e1b2c build_conditional_expr(unsigned int, tree_node*, tree_node*, tree_node*, int) ../../gcc-source-trunk/gcc/cp/call.c:5399 0x90b513 build_x_conditional_expr(unsigned int, tree_node*, tree_node*, tree_node*, int) ../../gcc-source-trunk/gcc/cp/typeck.c:6565 0x810ee3 cp_parser_question_colon_clause ../../gcc-source-trunk/gcc/cp/parser.c:9456 0x8100c6 cp_parser_assignment_expression ../../gcc-source-trunk/gcc/cp/parser.c:9492 0x8110b3 cp_parser_constant_expression ../../gcc-source-trunk/gcc/cp/parser.c:9770 0x8115d7 cp_parser_initializer_clause ../../gcc-source-trunk/gcc/cp/parser.c:21928 0x8147cb cp_parser_initializer ../../gcc-source-trunk/gcc/cp/parser.c:21868 0x8385d3 cp_parser_init_declarator ../../gcc-source-trunk/gcc/cp/parser.c:19677 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. $ ---------------------------- struct A { static int a; }; // should have been: // int t = A::a ? : 0; int t = A::A ? : 0;