Debian Codegraph @

gcc/testsuite/g++.dg/torture/pr33340.C

raw
1 // { dg-additional-options "-Wno-return-type" }
2
3 void* operator new(__SIZE_TYPE__, void* __p) {}
4
5 struct auto_ptr {
6 int* p;
7 ~auto_ptr() { delete p; }
8 };
9
10 typedef void* T;
11 struct vector {
12 void push_back(const T& __x) {
13 ::new(0) T(__x);
14 insert(__x);
15 }
16 void insert(const T& __x);
17 } v;
18
19 void g();
20 void f() {
21 auto_ptr ap;
22 if (ap.p) {
23 ap.p = new int();
24 }
25 g();
26 int* tmp = ap.p;
27 ap.p = 0;
28 v.push_back(tmp);
29 }