Debian Codegraph @

gcc/testsuite/g++.dg/opt/inline15.C

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