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.

Reply via email to