1 // { dg-do assemble } 2 // PRMS Id: 4346 3 // Bug: g++ dies on redefinition of cc_Array::repInvariant. 4 5 class ccObjectInfo 6 { 7 public: 8 virtual const ccObjectInfo& repInvariant (int =0) const; 9 }; 10 11 template <class T> 12 class cc_Array : public ccObjectInfo 13 { 14 public: 15 virtual const ccObjectInfo& repInvariant (int =0) const ; 16 }; 17 18 template <class T> repInvariant(int)19const ccObjectInfo& cc_Array<T>::repInvariant(int) const // { dg-message "previously declared" } 20 { return *this /* *this is required here */; } 21 22 template <class T> 23 class ccArray :public ccObjectInfo 24 { 25 ccArray (cc_Array<T>*); 26 }; 27 28 template <class T> 29 class ccObjArray : public ccArray<T> 30 { 31 ccObjArray(); 32 }; 33 34 template <class T> repInvariant(int)35const ccObjectInfo& cc_Array<T>::repInvariant(int) const // { dg-error "redefinition" } 36 { return 0; } 37 38 typedef ccObjArray< double> ccROIRuns; 39