summaryrefslogtreecommitdiffstats
path: root/clang/test
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
commit2ac2c725e00e114cc9f3091349a83a791a20cef7 (patch)
treed2e59b8c8bc0269d3ecfa3218860cda0698ed861 /clang/test
parentb00047a4759972a6cc9dadd41517ff0e824e11d2 (diff)
downloadbcm5719-llvm-2ac2c725e00e114cc9f3091349a83a791a20cef7.tar.gz
bcm5719-llvm-2ac2c725e00e114cc9f3091349a83a791a20cef7.zip
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.
llvm-svn: 130488
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/PCH/chain-cxx.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/clang/test/PCH/chain-cxx.cpp b/clang/test/PCH/chain-cxx.cpp
index 107ddfee1c0..af0a23afea9 100644
--- a/clang/test/PCH/chain-cxx.cpp
+++ b/clang/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
OpenPOWER on IntegriCloud