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

            Bug ID: 120311
           Summary: internal compiler error: in lookup_base, at
                    cp/search.cc:251
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mario.rodriguezb1 at um dot es
  Target Milestone: ---

ICE internal compiler error: in lookup_base, at cp/search.cc:251 since g++ 4.6.
It only occurs in c++ not in c although it uses no libraries.

```
int main(int argc, char *argv[])
{
   int x = ((struct {
      struct {
            char c;
      };
   }) {0}).c;
}
```

```
<source>:7:12: internal compiler error: in lookup_base, at cp/search.cc:251
    7 |    }) {0}).c;
      |            ^
0x2943295 diagnostic_context::diagnostic_impl(rich_location*,
diagnostic_metadata const*, diagnostic_option_id, char const*, __va_list_tag
(*) [1], diagnostic_t)
        ???:0
0x2961006 internal_error(char const*, ...)
        ???:0
0xad8afe fancy_abort(char const*, int, char const*)
        ???:0
0xdd2527 build_class_member_access_expr(cp_expr, tree_node*, tree_node*, bool,
int)
        ???:0
0xddba82 finish_class_member_access_expr(cp_expr, tree_node*, bool, int)
        ???:0
0xcfced3 c_parse_file()
        ???:0
0xe5f9d9 c_common_parse_file()
        ???:0
```

To reproduce:

https://godbolt.org/z/3aWbsnjrK
```

Reply via email to