OSDN Git Service

2008-01-16 Richard Guenther <rguenther@suse.de>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / torture / pr33340.C
1 void* operator new(__SIZE_TYPE__, void* __p) { }
2
3 struct auto_ptr {
4         int* p;
5         ~auto_ptr() { delete p; }
6 };
7
8 typedef void* T;
9 struct vector {
10         void push_back(const T& __x) {
11                 ::new(0) T(__x);
12                 insert(__x);
13         }
14         void insert(const T& __x);
15 } v;
16
17 void g();
18 void f() {
19         auto_ptr ap;
20         if (ap.p) {
21                 ap.p = new int();
22         }
23         g();
24         int* tmp = ap.p;
25         ap.p = 0;
26         v.push_back(tmp);
27 }