When performing substitution of default template template parameters
before the template parameters have acquired a proper context (e.g.,
because the enclosing context has yet to be built), provide empty
parameter lists for all outer template parameter scopes to inhibit any
substitution for those template parameters. Fixes PR9643 /
<rdar://problem/9251019>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133055 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/SemaTemplate/default-arguments.cpp b/test/SemaTemplate/default-arguments.cpp
index 9ea0fc2..6391369 100644
--- a/test/SemaTemplate/default-arguments.cpp
+++ b/test/SemaTemplate/default-arguments.cpp
@@ -121,3 +121,18 @@
 
 
 template<template<class> class X = B<int> > struct X7; // expected-error{{must be a class template}}
+
+namespace PR9643 {
+  template<typename T> class allocator {};
+  template<typename T, typename U = allocator<T> > class vector {};
+
+  template<template<typename U, typename = allocator<U> > class container,
+           typename DT>
+  container<DT> initializer(const DT& d) {
+    return container<DT>();
+  }
+
+  void f() {
+    vector<int, allocator<int> > v = initializer<vector>(5);
+  }
+}