This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Anonymous union members problem


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]