public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/97569] New: Declaring a struct in a field declaration of another struct.
@ 2020-10-25 16:18 anders.granlund.0 at gmail dot com
  2020-10-25 22:03 ` [Bug c++/97569] Declaring a struct in a field declaration of another struct. gcc and clang difference redi at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: anders.granlund.0 at gmail dot com @ 2020-10-25 16:18 UTC (permalink / raw)
  To: gcc-bugs

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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-10-28  8:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-25 16:18 [Bug c++/97569] New: Declaring a struct in a field declaration of another struct anders.granlund.0 at gmail dot com
2020-10-25 22:03 ` [Bug c++/97569] Declaring a struct in a field declaration of another struct. gcc and clang difference redi at gcc dot gnu.org
2020-10-25 23:58 ` anders.granlund.0 at gmail dot com
2020-10-26 10:03 ` redi at gcc dot gnu.org
2020-10-28  8:39 ` anders.granlund.0 at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).