1/* { dg-do compile } */ 2/* { dg-options "-c -O -fgcse-after-reload -fnon-call-exceptions" } */ 3template < typename _Tp > class new_allocator 4{ 5public: 6 typedef _Tp pointer; 7 template < typename _Tp1 > struct rebind 8 { 9 typedef new_allocator < _Tp1 > other; 10 }; 11 12}; 13 14template < typename > class allocator; 15 16template < typename _Alloc > struct __alloc_traits 17{ 18 typedef typename _Alloc::pointer pointer; 19 template < typename _Tp > struct rebind 20 { 21 typedef typename _Alloc::template rebind < _Tp >::other other; 22 }; 23 24}; 25 26template < typename _Tp, typename _Alloc > struct _Vector_base 27{ 28 typedef 29 typename 30 __alloc_traits < _Alloc >::template rebind < _Tp >::other _Tp_alloc_type; 31 typedef typename __alloc_traits < _Tp_alloc_type >::pointer pointer; 32 struct _Vector_impl 33 { 34 pointer _M_start; 35 pointer _M_end_of_storage; 36 }; 37 38 ~_Vector_base (); 39 _Vector_impl _M_impl; 40}; 41 42template < typename _Tp, typename _Alloc = allocator < _Tp > >class vector: 43_Vector_base < _Tp, _Alloc > 44{ 45 typedef _Vector_base < _Tp, _Alloc > _Base; 46public: 47 typedef typename _Base::pointer pointer; 48vector (): 49 _Base () 50 { 51 _M_erase_at_end (this->_M_impl._M_start); 52 } 53 void _M_erase_at_end (pointer) 54 { 55 } 56}; 57 58template < typename T > class clear_alloc: 59public new_allocator < T > 60{ 61}; 62 63void 64foo () 65{ 66 new vector < int, clear_alloc < int > >; 67} 68 69