rahul said:
No.
No.
I don't see anything wrong with the declaration.
Then you need to look at the standard more carefully:
6.7.2.1 Structure and union specifiers
Syntax
1 struct-or-union-specifier:
struct-or-union identifieropt { struct-declaration-list }
struct-or-union identifier
struct-or-union:
struct
union
struct-declaration-list:
struct-declaration
struct-declaration-list struct-declaration
Note that a struct-declaration-list ALWAYS has a struct-declaration!
Though this stuff
does not look like it can have any practical applications.
The standard does not mandate declaring a member in a structure.
Wrong. From N1256:
This
code compiles with '-ansi' flag on Linux/gcc.
That does not make it procude all required diagnostics. You need '-ansi
-pedantic' at which point it gives a warning. Note that a warning is
sufficient to meet the standards requirement for "invalid" code (a puch
in the face could also qualify, but I don't think an implementation that
did this would be very popular)
I don't see any reason why it should not be valid.
See above.
An imcomplete type would be
struct test;