Merged with mainline at revision 128810.
[official-gcc.git] / gcc / testsuite / g++.dg / torture / pr33340.C
blobbac882156b552b0d25a35268c4a52a8fca7acfa5
1 void* operator new(__SIZE_TYPE__, void* __p) { }
3 struct auto_ptr {
4         int* p;
5         ~auto_ptr() { delete p; }
6 };
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;
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);