Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/g++.dg/opt/inline15.C @ 111:04ced10e8804
gcc 7
author | kono |
---|---|
date | Fri, 27 Oct 2017 22:46:09 +0900 |
parents | |
children | 84e7813d76e9 |
comparison
equal
deleted
inserted
replaced
68:561a7518be6b | 111:04ced10e8804 |
---|---|
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 () { } | |
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 } | |
37 | |
38 void | |
39 test (P x) | |
40 { | |
41 E (x, fn2 ()); | |
42 } |