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

            Bug ID: 97569
           Summary: Declaring a struct in a field declaration of another
                    struct.
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: anders.granlund.0 at gmail dot com
  Target Milestone: ---

Consider the following c++ program:

  int main()
  {
      struct A
      {
        struct B *b;
      };

      using U = B;   
  }

Compile it with "-std=c++20 -pedantic-errors".

The gcc compiler accepts it.

Clang however rejects it with the following error 
message: "unknown type name 'B': using U = B;".

The interesting thing is that if we replace  struct S  with  struct S {}  both
compilers agree on rejecting the program.

I'm not sure if this is a bug in gcc or clang, but I think this is a gcc bug.

Reply via email to