summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaTemplate/example-dynarray.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-05-27 05:35:12 +0000
committerDouglas Gregor <dgregor@apple.com>2009-05-27 05:35:12 +0000
commit51783313799209f9d697dd85efb2395c05c0440c (patch)
treedfaeb7552ad7b7df3656f701261f1a606cd7410b /clang/test/SemaTemplate/example-dynarray.cpp
parent2517f334b44bbdd255fd602cdbf74703991e5fd5 (diff)
downloadbcm5719-llvm-51783313799209f9d697dd85efb2395c05c0440c.tar.gz
bcm5719-llvm-51783313799209f9d697dd85efb2395c05c0440c.zip
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(); llvm-svn: 72461
Diffstat (limited to 'clang/test/SemaTemplate/example-dynarray.cpp')
-rw-r--r--clang/test/SemaTemplate/example-dynarray.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/clang/test/SemaTemplate/example-dynarray.cpp b/clang/test/SemaTemplate/example-dynarray.cpp
index 990c799ee11..1fe85d920c3 100644
--- a/clang/test/SemaTemplate/example-dynarray.cpp
+++ b/clang/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);
OpenPOWER on IntegriCloud