From: Jason Merrill Date: Thu, 17 Jul 2025 13:46:35 +0000 (-0400) Subject: c++: constexpr array testcase [PR87097] X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b38382e36410a9a649b904a2d0a0abcb90f9c418;p=thirdparty%2Fgcc.git c++: constexpr array testcase [PR87097] This seems to have been fixed by r15-7260 for PR118285, but is sufficiently different to merit its own test. PR c++/87097 gcc/testsuite/ChangeLog: * g++.dg/cpp0x/constexpr-array29.C: New test. --- diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-array29.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-array29.C new file mode 100644 index 00000000000..714d050b503 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-array29.C @@ -0,0 +1,13 @@ +// PR c++/87097 +// { dg-do compile { target c++11 } } + +struct A { + constexpr A() : data() {} + struct X { int n; }; + X data[2]; +}; + +static_assert((A(), true), ""); +static_assert(A().data[0].n == 0, ""); +static_assert(A().data[1].n == 0, ""); +constexpr A x;