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

            Bug ID: 124991
           Summary: Internal compiler error on typeid of pointer to member
                    to anonymous union
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pdimov at gmail dot com
  Target Milestone: ---

```
#include <meta>
#include <typeinfo>

struct X
{
    union
    {
        char b;
        float c;
    };
};

template<std::meta::info J> constexpr auto pointer_of()
{
    return &[: J :];
};

int main()
{
    typeid( pointer_of< members_of( ^^X, std::meta::access_context::unchecked()
)[ 1 ] >() );
}
```

gives

```
<source>:21:1: internal compiler error: unexpected expression 'X::<anonymous>'
of kind field_decl
   21 | }
      | ^
```
(https://godbolt.org/z/4Pe8PPcar)

Reply via email to