The assertion at the end of the following code fails erroneously: #include <string> #include <cassert> struct test { union {int v = 0;}; std::string dummy; }; int main () { test x; x.v = 1; test y = x; assert (y.v == 1); } According to the assembly listing, it seems that the copy construction of y uses the default member initializer of v instead of x.v. This behaviour does not occur if the dummy member is removed causing the struct to be trivially copyable.
This issue was fixed on trunk recently. The fix will hopefully be backported to gcc-5.
It is already fixed. *** This bug has been marked as a duplicate of bug 66583 ***