Initial stab at a generalized operation for determining the
instantiation of a declaration from the template version (or version
that lives in a template) and a given set of template arguments. This
needs much, much more testing, but it suffices for simple examples
like

  typedef T* iterator;
  iterator begin();




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72461 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/SemaTemplate/example-dynarray.cpp b/test/SemaTemplate/example-dynarray.cpp
index 990c799..1fe85d9 100644
--- a/test/SemaTemplate/example-dynarray.cpp
+++ b/test/SemaTemplate/example-dynarray.cpp
@@ -77,16 +77,14 @@
     return Start[Idx];
   }
 
-  // FIXME: use these for begin/end when we can instantiate
-  // TypedefType nodes.
   typedef T* iterator;
   typedef const T* const_iterator;
 
-  T* begin() { return Start; }
-  const T* begin() const { return Start; }
+  iterator begin() { return Start; }
+  const_iterator begin() const { return Start; }
   
-  T* end() { return Last; }
-  const T* end() const { return Last; }
+  iterator end() { return Last; }
+  const_iterator end() const { return Last; }
   
 public:
   T* Start, *Last, *End;
@@ -115,6 +113,9 @@
   for (dynarray<int>::iterator I = di.begin(), IEnd = di.end(); I != IEnd; ++I)
     assert(*I == I - di.begin());
 
+  for (int I = 0, N = di.size(); I != N; ++I)
+    assert(di[I] == I);
+
   di.pop_back();
   assert(di.size() == 4);
   di.push_back(4);