/* { dg-do compile } */ void *fastMalloc (int n); void fastFree (void *p); template struct C { void deref () { delete static_cast (this); } }; template struct D { D (T *ptr) : m_ptr (ptr) { } ~D () { if (T * ptr = m_ptr) ptr->deref (); } T *operator-> () const; T *m_ptr; typedef T *UnspecifiedBoolType; operator UnspecifiedBoolType () const; }; template struct E { static void destruct (T * begin, T * end) { for (T * cur = begin; cur != end; ++cur) cur->~T (); } }; template class F; template struct G { static void destruct (T * begin, T * end) { E ::destruct (begin, end); } static void uninitializedFill (T * dst, T * dstEnd, const T & val) { F::uninitializedFill (dst, dstEnd, val); } }; template struct H { void allocateBuffer (int newCapacity) { m_buffer = static_cast (fastMalloc (newCapacity * sizeof (T))); } void deallocateBuffer (T * bufferToDeallocate) { if (m_buffer == bufferToDeallocate) fastFree (bufferToDeallocate); } T *buffer () { } int capacity () const { } T *m_buffer; }; template class I; template struct I : H { I (int capacity) { allocateBuffer (capacity); } ~I () { this->deallocateBuffer (buffer ()); } using H ::allocateBuffer; H ::buffer; // { dg-warning "deprecated" } }; template struct J { typedef T *iterator; ~J () { if (m_size) shrink (0); } J (const J &); int capacity () const { m_buffer.capacity (); } T & operator[](int i) { } iterator begin () { } iterator end () { return begin () + m_size; } void shrink (int size); template void append (const U &); int m_size; I m_buffer; }; template J ::J (const J & other) : m_buffer (other.capacity ()) { } template void J ::shrink (int size) { G ::destruct (begin () + size, end ()); m_size = size; } struct A : public C { virtual ~A (); typedef J > B; virtual A *firstChild () const; virtual A *nextSibling () const; virtual const B & children (int length); B m_children; }; const A::B & A::children (int length) { for (D obj = firstChild (); obj; obj = obj->nextSibling ()) { B children = obj->children (2); for (unsigned i = 0; i