PR12670: Support for initializing an array of non-aggregate class type from an
initializer list. Patch by Olivier Goffart, with extra testcases by Meador Inge
and Daniel Lunow.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159896 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/SemaCXX/constant-expression-cxx11.cpp b/test/SemaCXX/constant-expression-cxx11.cpp
index facd437..2cd66b6 100644
--- a/test/SemaCXX/constant-expression-cxx11.cpp
+++ b/test/SemaCXX/constant-expression-cxx11.cpp
@@ -1318,3 +1318,15 @@
// actually call it.
static_assert(S{}.t == 0, "");
}
+
+namespace PR12670 {
+ struct S {
+ constexpr S(int a0) : m(a0) {}
+ constexpr S() : m(6) {}
+ int m;
+ };
+ constexpr S x[3] = { {4}, 5 };
+ static_assert(x[0].m == 4, "");
+ static_assert(x[1].m == 5, "");
+ static_assert(x[2].m == 6, "");
+}