1 // { dg-do run }
2 /* { dg-options "-fcheck-new" } */
3 
4 typedef __SIZE_TYPE__ size_t;
5 
new(size_t,void * __p)6 inline void *operator new (size_t, void *__p) throw() { return __p; }
7 
8 struct _Vector_impl
9 {
10   int *_M_start;
11   int *_M_finish;
_Vector_impl_Vector_impl12   _Vector_impl () :_M_start (0), _M_finish (0) {}
13 };
14 
15 struct vector
16 {
17   _Vector_impl _M_impl;
_M_allocatevector18   int *_M_allocate (size_t __n)
19   {
20     return __n != 0 ? new int[__n] : 0;
21   }
push_backvector22   void push_back ()
23   {
24     new (this->_M_impl._M_finish) int ();
25     this->_M_impl._M_finish =
26       this->_M_allocate (this->_M_impl._M_finish - this->_M_impl._M_start) + 1;
27   }
28 };
29 
30 int
main()31 main ()
32 {
33   for (int i = 0; i <= 1; i++)
34     for (int j = 0; j <= 1; j++)
35       {
36 	vector a[2];
37 	a[i].push_back ();
38       }
39 }
40