[Bug c++/97446] New: gcc accepts an unnamed struct

tangyixuan at mail dot dlut.edu.cn gcc-bugzilla@gcc.gnu.org
Thu Oct 15 14:19:50 GMT 2020


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

            Bug ID: 97446
           Summary: gcc accepts an unnamed struct
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tangyixuan at mail dot dlut.edu.cn
  Target Milestone: ---

Hi, the following code has an error in 'S3' (maybe should be 'S2'). gcc accepts
it without error diagnostics.

$ cat s.cpp

template < class T > struct S1 {
        struct S2 {
                friend struct S1 <T>::S3;
        };
};

$ clang++ -c s.cpp
s.cpp:3:32: error: no struct named 'S3' in 'S1<T>'
                friend struct S1 <T>::S3;
                              ~~~~~~~~^
1 error generated.


More information about the Gcc-bugs mailing list