1// { dg-do assemble } 2// Origin: Loring Holden <lsh@cs.brown.edu> 3 4template <class T> 5class REFptr { 6 public: 7 virtual ~REFptr(); 8 REFptr<T> &operator = (const REFptr<T>& p); 9}; 10 11class STR { }; 12class str_ptr : public REFptr<STR> { }; 13 14template <class T> 15class ARRAY { 16 protected: 17 T *_array; 18 int _num; 19 int _max; 20 public: 21 virtual void realloc(int new_max) { 22 _max = new_max; 23 T *tmp = new T [_max]; 24 if (tmp == 0) return; 25 for (int i=0; i<_num; i++) { 26 tmp[i] = _array[i]; 27 } 28 delete [] _array; 29 _array = tmp; 30 } 31}; 32 33int 34main() 35{ 36 ARRAY<str_ptr> tags; 37} 38