------- Comment #4 from terra at gnome dot org 2009-11-03 13:47 ------- > I'm not sure whether using A in a union causes the implicitly-declared copy > assignment operator to be implicitly defined, but that seems to be what's > happening.
No, that's not quite it. The requirement for union members is that there cannot be a non-trivial copy assignment operator. gcc uses a different rule: it insists that there be a default copy assignment operator. Presumably someone thought those two formulations were the same. But they are not: struct A doesn't have a copy assignment operator at all. For the record, this kind of code occurs fairly naturally in C when creating trees with different node types, tagged here by "x". The problems arise when C++ code needs to interface with that C code. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39934