We discovered this in our project working under gcc4.9.2 (-std=c++14) but it is also present in gcc5.2 - whilst not present in clang. The code below does not copy b1 to b2 properly: - b2[0].c.a is 0 - b1.c.a Making b1 compiler time constant (by making makeA() function constexpr) "fixes" the problem: #include <iostream> struct A { int a; }; struct B { int b; A c; }; /*constexpr*/ //<-- contstexpr here "fixes" the problem A makeA() { A a = {2}; return a; } const B b1 = {1, makeA()}; B b2[] = { b1 }; int main() { std::cout << b2[0].c.a << std::endl; // 0 (should be 2) std::cout << b1.c.a << std::endl; // 2 } The link to coliru: http://coliru.stacked-crooked.com/a/4f1ef718fea4e76f The original example was with std::vector and much more complicated structs. We did an effort to simplify example. Simplifying more also "fixes" the problem. BR, Piotr Nycz (piotrwn1(at)gmail.com)
This bug is already fixed.
How to get information in which version it is fixed? What we discover ourselves: 4.9.1 - work 4.9.2 - fail 4.9.4 - work 5.2 - fail 6.0 (experimental) - work I need to know the newest stable version where it is fixed. How can I get this knowledge?
(In reply to Piotr Nycz from comment #2) > How to get information in which version it is fixed? > What we discover ourselves: > 4.9.1 - work > 4.9.2 - fail > 4.9.4 - work > 5.2 - fail > 6.0 (experimental) - work > > I need to know the newest stable version where it is fixed. How can I get > this knowledge? You can run an inverse "git bisect" on the source tree for example.
r231777 aka PR67550 fixed that.
And yes it is a dup of bug 67550. *** This bug has been marked as a duplicate of bug 67550 ***