assignment operators for union member classes

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

 




Hi,

Does anyone know why asignment operators are not allowed for union class members ?
Other compilers accept this code, but I can't compile the following code with GCC.

( error: member 'A C::::::aa' with copy assignment operator not allowed in union)

class A{
public:
int a;
A& operator=(const A&){return (*this);}
int AFunc(void){}
};


class B{
public:
int b;
};


class C{
public:
C(){}
union
{
struct {A aa;}; // builds with warning if level4is set
B bb;
};
};

Thanks

_________________________________________________________________
Free games, great prizes - get gaming at Gamesbox. 
http://www.searchgamesbox.com


[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