OSDN Git Service

PR c++/46124
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / torture / pr48695.C
1 // { dg-do run }
2
3 typedef __SIZE_TYPE__ size_t;
4
5 inline void *operator new (size_t, void *__p) throw() { return __p; }
6
7 struct _Vector_impl
8 {
9   int *_M_start;
10   int *_M_finish;
11   _Vector_impl () :_M_start (0), _M_finish (0) {}
12 };
13
14 struct vector
15 {
16   _Vector_impl _M_impl;
17   int *_M_allocate (size_t __n)
18   {
19     return __n != 0 ? new int[__n] : 0;
20   }
21   void push_back ()
22   {
23     new (this->_M_impl._M_finish) int ();
24     this->_M_impl._M_finish =
25       this->_M_allocate (this->_M_impl._M_finish - this->_M_impl._M_start) + 1;
26   }
27 };
28
29 int
30 main ()
31 {
32   for (int i = 0; i <= 1; i++)
33     for (int j = 0; j <= 1; j++)
34       {
35         vector a[2];
36         a[i].push_back ();
37       }
38 }