Anonymous union assignment problem
Stefan Westerfeld
stefan@space.twc.de
Mon Mar 26 11:26:00 GMT 2001
Hi!
It seems that there is some problem with assignment of anonymous unions in
recent gccs (i.e. gcc3 CVS). The following code is IMHO correct (does compile
with gcc-2.95.2), but causes problems with the CVS gcc.
stefan@stefan:/tmp$ /usr/local/gcc-2.97/bin/g++ -c au.cc
au.cc: In member function `G& G::operator=(const G&)':
au.cc:7: `G::<anonymous union>& G::<anonymous union>::operator=(const
G::<anonymous union>&)' is inaccessible
au.cc:14: within this context
Cu... Stefan
struct F {
int i;
F& operator=(const F& other) { i = other.i; }
};
struct G {
union { char c; char d; }; // if you name the union u, it will work
F f; // if you remove this line, it will work, too
};
main()
{
G g1,g2;
g1 = g2;
}
--
-* Stefan Westerfeld, stefan@space.twc.de (PGP!), Hamburg/Germany
KDE Developer, project infos at http://space.twc.de/~stefan/kde *-
More information about the Gcc-bugs
mailing list