summaryrefslogtreecommitdiff
path: root/test/PCH
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2013-04-20 22:23:29 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2013-04-20 22:23:29 +0000
commitc41a25a97f27dd1847cf2f806b3b197a2cd85233 (patch)
tree4f185db7c7f497f95e074903b8d8e2303b4f7785 /test/PCH
parentc3bf52ced9652f555aa0767bb822ec4c64546212 (diff)
downloadclang-c41a25a97f27dd1847cf2f806b3b197a2cd85233.tar.gz
clang-c41a25a97f27dd1847cf2f806b3b197a2cd85233.tar.bz2
clang-c41a25a97f27dd1847cf2f806b3b197a2cd85233.tar.xz
Add another test I forgot to svn add.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179959 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/PCH')
-rw-r--r--test/PCH/cxx1y-default-initializer.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/PCH/cxx1y-default-initializer.cpp b/test/PCH/cxx1y-default-initializer.cpp
new file mode 100644
index 0000000000..5a68f27045
--- /dev/null
+++ b/test/PCH/cxx1y-default-initializer.cpp
@@ -0,0 +1,30 @@
+// RUN: %clang_cc1 -pedantic -std=c++1y -emit-pch %s -o %t
+// RUN: %clang_cc1 -pedantic -std=c++1y -include-pch %t -verify %s
+
+#ifndef HEADER_INCLUDED
+
+#define HEADER_INCLUDED
+
+struct A {
+ int x;
+ int y = 3;
+ int z = x + y;
+};
+template<typename T> constexpr A make() { return A {}; }
+template<typename T> constexpr A make(T t) { return A { t }; }
+
+struct B {
+ int z1, z2 = z1;
+ constexpr B(int k) : z1(k) {}
+};
+
+#else
+
+static_assert(A{}.z == 3, "");
+static_assert(A{1}.z == 4, "");
+static_assert(A{.y = 5}.z == 5, ""); // expected-warning {{C99}}
+static_assert(A{3, .y = 1}.z == 4, ""); // expected-warning {{C99}}
+static_assert(make<int>().z == 3, "");
+static_assert(make<int>(12).z == 15, "");
+
+#endif