1 // { dg-do assemble } 2 // { dg-options "-O3" } 3 // Origin: Mark Mitchell <mark@codesourcery.com> 4 5 class ostream; 6 7 struct S 8 { 9 virtual void print(ostream&) const = 0; 10 }; 11 12 template <class _Tp> 13 class vector 14 { 15 public: 16 _Tp& operator[](unsigned __n) const { return *(_M_start + __n); } 17 _Tp* _M_start; 18 }; 19 20 class T 21 { 22 public: 23 24 void print(ostream&) const; 25 26 vector<S*> bcList_m; 27 }; 28 print(ostream & o)29void T::print(ostream& o) const 30 { 31 int n = 3; 32 33 for (int i = 0; i < n; ++i) 34 bcList_m[i]->print(o); 35 return; 36 } 37 38 ostream& 39 operator<<(ostream& o, const T& bcList) 40 { 41 bcList.print(o); 42 return o; 43 } 44 45 46 47 48 49 50 51 52