summaryrefslogtreecommitdiff
path: root/test/PCH
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2013-02-16 00:48:59 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2013-02-16 00:48:59 +0000
commit7640b02a561fd2b2c58a227b262b0c1ba93622ae (patch)
tree0e65dcce2cde6f4900cc54291e54623f01ffa2d2 /test/PCH
parent8f2fcd3ad1a55ddb80a32d8dc6acf9221e0fb4f0 (diff)
downloadclang-7640b02a561fd2b2c58a227b262b0c1ba93622ae.tar.gz
clang-7640b02a561fd2b2c58a227b262b0c1ba93622ae.tar.bz2
clang-7640b02a561fd2b2c58a227b262b0c1ba93622ae.tar.xz
[PCH] Deserializing the DeclContext of a template parameter is not safe
until recursive loading is finished. Otherwise we may end up with a template trying to deserialize a template parameter that is in the process of getting loaded. rdar://13135282 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175329 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/PCH')
-rw-r--r--test/PCH/cxx-templates.cpp6
-rw-r--r--test/PCH/cxx-templates.h26
2 files changed, 32 insertions, 0 deletions
diff --git a/test/PCH/cxx-templates.cpp b/test/PCH/cxx-templates.cpp
index d27e9ca93c..ddebae4df2 100644
--- a/test/PCH/cxx-templates.cpp
+++ b/test/PCH/cxx-templates.cpp
@@ -79,3 +79,9 @@ namespace TestNestedExpansion {
Int &g(Int, int, double);
Int &test = NestedExpansion<char, char, char>().f(0, 1, 2, Int(3), 4, 5.0);
}
+
+namespace rdar13135282 {
+ void test() {
+ __mt_alloc<> mt = __mt_alloc<>();
+ }
+}
diff --git a/test/PCH/cxx-templates.h b/test/PCH/cxx-templates.h
index 756f208b76..3dda059026 100644
--- a/test/PCH/cxx-templates.h
+++ b/test/PCH/cxx-templates.h
@@ -220,3 +220,29 @@ template<typename...A> struct NestedExpansion {
template<typename...B> auto f(A...a, B...b) -> decltype(g(a + b...));
};
template struct NestedExpansion<char, char, char>;
+
+namespace rdar13135282 {
+template < typename _Alloc >
+void foo(_Alloc = _Alloc());
+
+template < bool > class __pool;
+
+template < template < bool > class _PoolTp >
+struct __common_pool {
+ typedef _PoolTp < 0 > pool_type;
+};
+
+template < template < bool > class _PoolTp >
+struct __common_pool_base : __common_pool < _PoolTp > {};
+
+template < template < bool > class _PoolTp >
+struct A : __common_pool_base < _PoolTp > {};
+
+template < typename _Poolp = A < __pool > >
+struct __mt_alloc {
+ typedef typename _Poolp::pool_type __pool_type;
+ __mt_alloc() {
+ foo<__mt_alloc<> >();
+ }
+};
+}