summaryrefslogtreecommitdiffstats
path: root/test/PCH/chain-cxx.cpp
diff options
context:
space:
mode:
authorSebastian Redl <sebastian.redl@getdesigned.at>2011-04-29 08:19:30 +0000
committerSebastian Redl <sebastian.redl@getdesigned.at>2011-04-29 08:19:30 +0000
commitf79a71908d6f28cb2bc0c081d9a801ed14d61d82 (patch)
tree7442ee6471bcf6ab641f771befe670fc0faea9ed /test/PCH/chain-cxx.cpp
parent0acc4ea40d2a75fbaf385e095a252f59078c7b94 (diff)
Add a decl update when a static data member of a class template is instantiated in a different PCH than its containing class. Otherwise we get double definition errors. Fixes a Boost.MPL problem that affects Boost.Accumulators and probably a lot more of Boost.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130488 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/PCH/chain-cxx.cpp')
-rw-r--r--test/PCH/chain-cxx.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/PCH/chain-cxx.cpp b/test/PCH/chain-cxx.cpp
index 107ddfee1c..af0a23afea 100644
--- a/test/PCH/chain-cxx.cpp
+++ b/test/PCH/chain-cxx.cpp
@@ -35,9 +35,23 @@ typedef TS2<int> TS2int;
template <typename T> struct TestBaseSpecifiers { };
template<typename T> struct TestBaseSpecifiers2 : TestBaseSpecifiers<T> { };
+template <typename T>
+struct TS3 {
+ static const int value = 0;
+};
+template <typename T>
+const int TS3<T>::value;
+// Instantiate struct, but not value.
+struct instantiate : TS3<int> {};
+
+
//===----------------------------------------------------------------------===//
#elif not defined(HEADER2)
#define HEADER2
+#if !defined(HEADER1)
+#error Header inclusion order messed up
+#endif
+
//===----------------------------------------------------------------------===//
// Dependent header for C++ chained PCH test
@@ -80,6 +94,9 @@ struct TestBaseSpecifiers4 : TestBaseSpecifiers3 { };
struct A { };
struct B : A { };
+// Instantiate TS3's member.
+static const int ts3m1 = TS3<int>::value;
+
//===----------------------------------------------------------------------===//
#else
//===----------------------------------------------------------------------===//
@@ -107,5 +124,8 @@ void test() {
B b;
}
+// Should have remembered that there is a definition.
+static const int ts3m2 = TS3<int>::value;
+
//===----------------------------------------------------------------------===//
#endif