This bug was fixed in r238395, so what remains to do for GCC 7 is to add a testcase and close the PR.
Tested on x86_64-linux, ok for trunk? 2017-01-13 Marek Polacek <pola...@redhat.com> PR c++/71166 * g++.dg/cpp0x/constexpr-array18.C: New test. diff --git gcc/testsuite/g++.dg/cpp0x/constexpr-array18.C gcc/testsuite/g++.dg/cpp0x/constexpr-array18.C index e69de29..0f2d86e 100644 --- gcc/testsuite/g++.dg/cpp0x/constexpr-array18.C +++ gcc/testsuite/g++.dg/cpp0x/constexpr-array18.C @@ -0,0 +1,23 @@ +// PR c++/71166 +// { dg-do compile { target c++11 } } + +struct Foo { int value; }; + +constexpr Foo MakeFoo() { return Foo{0}; } + +struct Bar { + Foo color = MakeFoo(); +}; + +struct BarContainer { + Bar array[1]; +}; + +Foo X () +{ + return MakeFoo (); +} + +void Foo() { + new BarContainer(); +} Marek