Anonymous union members problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux