blob: 5da3a610519096c024d7df7b0cfc8e7258bf5049 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
// PR tree-optimization/40813
// { dg-do compile }
// { dg-options "-O -fcheck-new" }
typedef __SIZE_TYPE__ size_t;
typedef void *P;
struct A;
struct B
{
void *b[5];
A *foo () { return (A *) & b[0]; }
};
struct A
{
void *operator new (size_t x, B &y) { return y.foo (); }
};
struct C : public A
{
virtual int bar () { }
};
struct D : public C
{
static B baz (unsigned *x) { B b; new (b) D (x); return b; }
D (unsigned *x) { }
};
struct E
{
B e;
B fn (unsigned *a) { return D::baz (a); }
E (P b, unsigned *a) : e (fn (a)) { }
};
static unsigned *
fn2 ()
{
}
void
test (P x)
{
E (x, fn2 ());
}
|