diff options
author | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
---|---|---|
committer | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
commit | 554fd8c5195424bdbcabf5de30fdc183aba391bd (patch) | |
tree | 976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/g++.dg/torture/pr35164-1.C | |
download | cbb-gcc-4.6.4-upstream.tar.bz2 cbb-gcc-4.6.4-upstream.tar.xz |
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig;
imported gcc-4.6.4 source tree from verified upstream tarball.
downloading a git-generated archive based on the 'upstream' tag
should provide you with a source tree that is binary identical
to the one extracted from the above tarball.
if you have obtained the source via the command 'git clone',
however, do note that line-endings of files in your working
directory might differ from line-endings of the respective
files in the upstream repository.
Diffstat (limited to 'gcc/testsuite/g++.dg/torture/pr35164-1.C')
-rw-r--r-- | gcc/testsuite/g++.dg/torture/pr35164-1.C | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/torture/pr35164-1.C b/gcc/testsuite/g++.dg/torture/pr35164-1.C new file mode 100644 index 000000000..1704c2226 --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr35164-1.C @@ -0,0 +1,69 @@ +typedef __SIZE_TYPE__ size_t; +template<typename _Iterator, typename _Container> class __normal_iterator { +public: + const _Iterator& base() const; +}; +template<typename _BI1, typename _BI2> inline +void copy_backward(_BI1 __first, _BI1 __last, _BI2 __result) { + while (__first != __last) *--__result = *--__last; +} +template<typename _Tp> struct _Vector_base { + struct _Vector_impl { _Tp* _M_finish; }; + _Vector_impl _M_impl; +}; +template<typename _Tp > class vector : protected _Vector_base<_Tp> { + typedef vector<_Tp> vector_type; + typedef _Tp * pointer; + typedef _Tp & reference; + typedef __normal_iterator<pointer, vector_type> iterator; + typedef size_t size_type; +public: + iterator end(); + void resize(size_type __new_size) { insert(end(), __new_size); } + reference operator[](size_type __n); + void insert(iterator __position, size_type __n) + { + pointer __old_finish(this->_M_impl._M_finish); + copy_backward(__position.base(), __old_finish - __n, __old_finish); + } +}; +struct A { + virtual ~A (); + void incRef (); + void decRef (); +}; +struct C : public A { + static C *alloc (); +}; +template <class T> struct B { + B () : ptr (T::alloc ()) { } + B (T *a_ptr) : ptr (a_ptr) { } + ~B () { decRef (); } + B& operator= (const B<T>& a) { if (a.get () != this->get ()) { decRef (); +incRef (); } } + template<class U> operator B<U> () const { return B<U> (ptr); } + T* operator-> () const { } + T* get () const { return ptr; } + void decRef () const { if (ptr != 0) ptr->decRef (); } + void incRef () const { if (ptr != 0) ptr->incRef (); } + T *ptr; +}; +struct D : public C { + template <class T> inline void foo (const B<T> & x) { d.resize (1); d[0] = x; +} + vector<B <C> > d; +}; +struct E : public C { + static E *alloc (); +}; +struct F : public D { + static F *alloc (); +}; +void foo (vector<B<D> > & x) { + for (int i = 0; i < 2; ++i) + { + B<F> l; + B<E> m; + l->foo (m); + } +} |