From b38382e36410a9a649b904a2d0a0abcb90f9c418 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Thu, 17 Jul 2025 09:46:35 -0400 Subject: [PATCH] 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. --- gcc/testsuite/g++.dg/cpp0x/constexpr-array29.C | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-array29.C 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; -- 2.47.2