Anonymous union members problem
Mathieu Fluhr
mfluhr@nero.com
Mon Apr 19 13:09:00 GMT 2004
Hello
I am porting VC++ source code to Linux using g++ 3.3 and I am currently
getting some errors with C++ code like this sample program:
struct foo
{
struct
{
typedef int structType;
union
{
int test;
};
};
};
int main()
{
return 0;
}
When I try to compile this program, I get the following message:
mathieu@c-l-175:~/tests/bitfields$ g++-3.3 -Wall bitfields.cpp
bitfields.cpp:5: error: `typedef int foo::<anonymous
struct>::structType'
invalid; an anonymous union can only have non-static data members
Is this invalid C++ code ? If yes is there a way to make it valid and
compilable under Linux ?
Regards,
Mathieu
More information about the Gcc-help
mailing list