Mixing class and struct

It looks to me like it’s defined behavior. In particular, ยง9.1/2 says:

A declaration consisting solely of class-key identifier ; is either a redeclaration of the
name in the current scope or a forward declaration of the identifier as a class name. It introduces the class name into the current scope.

The standard distinguishes between using class, struct or union when defining a class, but here, talking about a declaration, no such distinction is made — using one class-key is equivalent to any other.

Leave a Comment