diff options
Diffstat (limited to 'gcc/testsuite/g++.dg/opt/inline15.C')
-rw-r--r-- | gcc/testsuite/g++.dg/opt/inline15.C | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/opt/inline15.C b/gcc/testsuite/g++.dg/opt/inline15.C new file mode 100644 index 000000000..5da3a6105 --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/inline15.C @@ -0,0 +1,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 ()); +} |