This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/70820] GCC incorrectly accepts code that accesses nested names in an incomplete type


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

--- Comment #5 from Fabio Rocha <fdrocha at gmail dot com> ---
(In reply to Jonathan Wakely from comment #4)
> (In reply to Fabio Rocha from comment #3) 
> > Still, it feels pretty strange that uncommenting the "First Assert" is what
> > makes the code incorrect...
> 
> That's not strange at all, the assertion requires the value of the static
> data member, so it causes it to be instantiated, while the type is
> incomplete.
> 
> Without that assertion the static data member is not instantiated until the
> definition of ::k, after the types are complete.

That makes sense, it's pretty nice that it works out like this.
For what it's worth, clang rejects the code, but I am convinced gcc is in the
right.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]