RomulusTFM
Well...consider this:
| // OK
// {
typedef struct Y {float a;} Y;
int Y = 2;
// }
|
Oh wow, man.
I was about to ask if you'd tested this, 'cause I knew I'd previously tested code samples like this with GCC, EDG, and Clang. (And those compiler front ends do issue an error against this example.)
But holy crap MSVC accepts this.
The Microsoft Visual Studio C++ compiler is so broken.
[Spelling the name out to help future searches to find this.]
The Microsoft Visual Studio C++ compiler is so much more unexpectedly broken than I previously already knew it to be. (And I've written a reasonably thorough __if_exists emulator!)
Ok, so, the above code sample is ill-formed C and ill-formed C++. A typedef name does not co-exist with any other "ordinary" identifier with the same spelling. But in Microsoft Visual Studio C++, it does.
*HOWEVER*, if you use the Microsoft Visual Studio C/C++ compiler to compile this as C code, you do get an error:
| x.c
x.c(4) : error C2371: 'Y' : redefinition; different basic types
x.c(3) : see declaration of 'Y'
|