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

            Bug ID: 123561
           Summary: ICE in set_underlying_type, at
                    c-family/c-common.cc:9017
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jirehguo at tju dot edu.cn
  Target Milestone: ---

Compiler Explorer: https://godbolt.org/z/cz63WrfP4
The following c++ code crash gcc trunk and 12,13,14,15 with checking since
12.1.

Code:
```cpp
template <typename T> struct Container {
    using bases = __direct_bases(T);
};
```

Stack dump:
```
<source>:2:36: internal compiler error: tree check: expected tree that contains
'common' structure, have 'bases' in set_underlying_type, at
c-family/c-common.cc:9017
    2 |     using bases = __direct_bases(T);
      |                                    ^
0x2926688 diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*) [1], diagnostics::kind)
        ???:0
0x291b44b internal_error(char const*, ...)
        ???:0
0xa1b84e tree_contains_struct_check_failed(tree_node const*,
tree_node_structure_enum, char const*, int, char const*)
        ???:0
0xc30ad3 grokfield(cp_declarator const*, cp_decl_specifier_seq*, tree_node*,
bool, tree_node*, tree_node*)
        ???:0
0xd57563 c_parse_file()
        ???:0
0xec8ee9 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