summaryrefslogtreecommitdiffstats
path: root/test/PCH
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2016-08-24 21:25:37 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2016-08-24 21:25:37 +0000
commitd9ba5a48cdddf332d3ccb6806c0c9ea03dcea099 (patch)
tree6d780cce8bc484453e0407ac085d55d0fc15dd8c /test/PCH
parent5fcbbd604f20ee02cd29a879d17ca78ab171905c (diff)
PR29097: add an update record when we instantiate the default member
initializer of an imported field. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@279667 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/PCH')
-rw-r--r--test/PCH/cxx1y-default-initializer.cpp27
1 files changed, 21 insertions, 6 deletions
diff --git a/test/PCH/cxx1y-default-initializer.cpp b/test/PCH/cxx1y-default-initializer.cpp
index 1f8d9a5d08..c9593a56d2 100644
--- a/test/PCH/cxx1y-default-initializer.cpp
+++ b/test/PCH/cxx1y-default-initializer.cpp
@@ -1,10 +1,10 @@
-// RUN: %clang_cc1 -pedantic -std=c++1y %s -o %t
-// RUN: %clang_cc1 -pedantic -std=c++1y -emit-pch %s -o %t
-// RUN: %clang_cc1 -pedantic -std=c++1y -include-pch %t -verify %s
+// RUN: %clang_cc1 -pedantic -std=c++1y -include %s -include %s -verify %s
+// RUN: %clang_cc1 -pedantic -std=c++1y -emit-pch -o %t.1 %s
+// RUN: %clang_cc1 -pedantic -std=c++1y -include-pch %t.1 -emit-pch -o %t.2 %s
+// RUN: %clang_cc1 -pedantic -std=c++1y -include-pch %t.2 -verify %s
-#ifndef HEADER_INCLUDED
-
-#define HEADER_INCLUDED
+#ifndef HEADER_1
+#define HEADER_1
struct A {
int x;
@@ -19,6 +19,20 @@ struct B {
constexpr B(int k) : z1(k) {}
};
+template<typename T> struct C {
+ constexpr C() {}
+ T c = T();
+ struct U {};
+};
+// Instantiate C<int> but not the default initializer.
+C<int>::U ciu;
+
+#elif !defined(HEADER_2)
+#define HEADER_2
+
+// Instantiate the default initializer now, should create an update record.
+C<int> ci;
+
#else
static_assert(A{}.z == 3, "");
@@ -27,5 +41,6 @@ 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, "");
+static_assert(C<int>().c == 0, "");
#endif