111
|
1 // { dg-do run }
|
131
|
2 /* { dg-options "-fcheck-new" } */
|
111
|
3
|
|
4 typedef __SIZE_TYPE__ size_t;
|
|
5
|
|
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;
|
|
12 _Vector_impl () :_M_start (0), _M_finish (0) {}
|
|
13 };
|
|
14
|
|
15 struct vector
|
|
16 {
|
|
17 _Vector_impl _M_impl;
|
|
18 int *_M_allocate (size_t __n)
|
|
19 {
|
|
20 return __n != 0 ? new int[__n] : 0;
|
|
21 }
|
|
22 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
|
|
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 }
|