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
diff --git a/test/PCH/chain-cxx.cpp b/test/PCH/chain-cxx.cpp
index 107ddfe..af0a23a 100644
--- a/test/PCH/chain-cxx.cpp
+++ b/test/PCH/chain-cxx.cpp
@@ -35,9 +35,23 @@
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 A { };
struct B : A { };
+// Instantiate TS3's member.
+static const int ts3m1 = TS3<int>::value;
+
//===----------------------------------------------------------------------===//
#else
//===----------------------------------------------------------------------===//
@@ -107,5 +124,8 @@
B b;
}
+// Should have remembered that there is a definition.
+static const int ts3m2 = TS3<int>::value;
+
//===----------------------------------------------------------------------===//
#endif