https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118061

            Bug ID: 118061
           Summary: ICE: tree check: expected class 'type', have
                    'exceptional' (error_mark) in
                    tagged_types_tu_compatible_p, at c/c-typeck.cc:1946
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bic60176 at gmail dot com
  Target Milestone: ---

Created attachment 59876
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=59876&action=edit
testcase

Compiler Explorer: https://godbolt.org/z/e8M85vrEe

console:
<source>: In function 'main':
<source>:4:21: error: lvalue required as increment operand
    4 |         sizeof(int[1++]);
      |                     ^~
<source>:5:20: error: 'n' undeclared (first use in this function)
    5 |         typeof(int[n++]);
      |                    ^
<source>:5:20: note: each undeclared identifier is reported only once for each
function it appears in
<source>:5:9: warning: useless type name in empty declaration
    5 |         typeof(int[n++]);
      |         ^~~~~~
<source>:6:25: error: lvalue required as increment operand
    6 |         struct { int x[1++]; };
      |                         ^~
<source>:6:16: warning: unnamed struct/union that defines no instances
    6 |         struct { int x[1++]; };
      |                ^
<source>:7:29: error: lvalue required as increment operand
    7 |         struct foo { int x[1++]; };
      |                             ^~
<source>:8:25: error: lvalue required as increment operand
    8 |         struct { int x[1++]; } x;
      |                         ^~
<source>:8:16: internal compiler error: tree check: expected class 'type', have
'exceptional' (error_mark) in tagged_types_tu_compatible_p, at
c/c-typeck.cc:1946
    8 |         struct { int x[1++]; } x;
      |                ^
0x261a125 diagnostic_context::diagnostic_impl(rich_location*,
diagnostic_metadata const*, diagnostic_option_id, char const*, __va_list_tag
(*) [1], diagnostic_t)
        ???:0
0x2630ef6 internal_error(char const*, ...)
        ???:0
0x8f2551 tree_class_check_failed(tree_node const*, tree_code_class, char
const*, int, char const*)
        ???:0
0xa373d7 comptypes_equiv_p(tree_node*, tree_node*)
        ???:0
0xa2a480 hash_table<c_struct_hasher, false,
xcallocator>::find_slot_with_hash(tree_node* const&, unsigned int,
insert_option)
        ???:0
0xa26781 finish_struct(unsigned long, tree_node*, tree_node*, tree_node*,
c_struct_parse_info*, tree_node**)
        ???:0
0xa96748 c_parser_declspecs(c_parser*, c_declspecs*, bool, bool, bool, bool,
bool, bool, bool, c_lookahead_kind)
        ???:0
0xaabe0e c_parse_file()
        ???:0
0xb29d69 c_common_parse_file()
        ???:0
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
Compiler returned: 1

Reply via email to