189976Sbde// { dg-do assemble } 289976Sbde// Origin: Loring Holden <lsh@cs.brown.edu> 3170913Sdougb 4170913Sdougbtemplate <class T> 5170913Sdougbclass REFptr { 6170913Sdougb public: 7139103Sru virtual ~REFptr(); 8170913Sdougb REFptr<T> &operator = (const REFptr<T>& p); 9170913Sdougb}; 1089976Sbde 1189976Sbdeclass 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