https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95955
Bug ID: 95955 Summary: ICE: tree check: expected integer_type or enumeral_type or boolean_type or real_type or fixed_point_type, have union_type in int_fits_type_p, at tree.c:8952 Product: gcc Version: 11.0 Status: UNCONFIRMED Keywords: error-recovery, ice-on-invalid-code Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: haoxintu at gmail dot com Target Milestone: --- This code, bug.cc, reduced by C-Reduce, makes GCC-trunk ICE. $cat bug.cc enum class a : struct {} template < < > > enum class a : union b {} enum class a { c $g++ bug.cc bug.cc:1:25: error: expected ‘;’ after struct definition 1 | enum class a : struct {} | ^ | ; bug.cc:1:24: error: underlying type ‘<unnamed struct>’ of ‘a’ must be an integral type 1 | enum class a : struct {} | ^ bug.cc:2:12: error: expected identifier before ‘<’ token 2 | template < < > > enum class a : union b {} | ^ bug.cc:2:12: error: expected ‘>’ before ‘<’ token bug.cc:2:43: error: expected ‘;’ after union definition 2 | template < < > > enum class a : union b {} | ^ | ; bug.cc:3:12: error: different underlying type in enum ‘enum class a’ 3 | enum class a { c | ^ bug.cc:1:24: note: previous definition here 1 | enum class a : struct {} | ^ bug.cc:3:16: internal compiler error: tree check: expected integer_type or enumeral_type or boolean_type or real_type or fixed_point_type, have union_type in int_fits_type_p, at tree.c:8952 3 | enum class a { c | ^ 0x7c2dcf tree_check_failed(tree_node const*, char const*, int, char const*, ...) ../../gcc/tree.c:9685 0x7c9ce1 tree_check5(tree_node const*, char const*, int, char const*, tree_code, tree_code, tree_code, tree_code, tree_code) ../../gcc/tree.h:3648 0x7c9ce1 int_fits_type_p(tree_node const*, tree_node const*) ../../gcc/tree.c:8952 0x911daa build_enumerator(tree_node*, tree_node*, tree_node*, tree_node*, unsigned int) ../../gcc/cp/decl.c:15906 0x9a2447 cp_parser_enumerator_definition ../../gcc/cp/parser.c:19545 0x9a2447 cp_parser_enumerator_list ../../gcc/cp/parser.c:19474 0x9a2447 cp_parser_enum_specifier ../../gcc/cp/parser.c:19405 0x9a2447 cp_parser_type_specifier ../../gcc/cp/parser.c:17734 0x9a2a02 cp_parser_decl_specifier_seq ../../gcc/cp/parser.c:14410 0x9a35c1 cp_parser_simple_declaration ../../gcc/cp/parser.c:13664 0x9cc926 cp_parser_declaration ../../gcc/cp/parser.c:13484 0x9cd06a cp_parser_translation_unit ../../gcc/cp/parser.c:4761 0x9cd06a c_parse_file() ../../gcc/cp/parser.c:44043 0xae4dbb c_common_parse_file() ../../gcc/c-family/c-opts.c:1190 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. $g++ --version g++ (GCC) 11.0.0 20200626 (experimental) Copyright (C) 2020 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.