Debian Codegraph @

gcc/testsuite/g++.dg/ipa/pr61540.C

raw
1 /* { dg-do compile } */
2 /* { dg-options "-O3 -fno-early-inlining" } */
3
4 struct data {
5 data(int) {}
6 };
7
8 struct top {
9 virtual int topf() { return 0; }
10 };
11
12 struct intermediate: top {
13 int topf() /* override */ { return 0; }
14 };
15
16 struct child1: top {
17 void childf()
18 {
19 data d(topf());
20 }
21 };
22
23 struct child2: intermediate {};
24
25 void test(top& t)
26 {
27 child1& c = static_cast<child1&>(t);
28 c.childf();
29 child2 d;
30 test(d);
31 }
32
33 int main (int argc, char **argv)
34 {
35 child1 c;
36 test (c);
37 return 0;
38 }