diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-05-27 05:35:12 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-05-27 05:35:12 +0000 |
commit | 815215daf8f642b53a28212313fca7b9f77e5b9d (patch) | |
tree | 69e5ffd49e965203e38e6dfa545c6cb08f300fb9 /test/SemaTemplate/example-dynarray.cpp | |
parent | 7ff69269cf13583a981b265d4edee689feb4a830 (diff) |
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
Diffstat (limited to 'test/SemaTemplate/example-dynarray.cpp')
-rw-r--r-- | test/SemaTemplate/example-dynarray.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/test/SemaTemplate/example-dynarray.cpp b/test/SemaTemplate/example-dynarray.cpp index 990c799ee1..1fe85d920c 100644 --- a/test/SemaTemplate/example-dynarray.cpp +++ b/test/SemaTemplate/example-dynarray.cpp @@ -77,16 +77,14 @@ class dynarray { 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 @@ int main() { 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); |