blob: e7dee7262c1c38c753f8afc1994695071e0a8e2f (
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
|
/* { dg-do compile } */
/* { dg-options "-O3 -fno-early-inlining" } */
struct data {
data(int) {}
};
struct top {
virtual int topf() {}
};
struct intermediate: top {
int topf() /* override */ { return 0; }
};
struct child1: top {
void childf()
{
data d(topf());
}
};
struct child2: intermediate {};
void test(top& t)
{
child1& c = static_cast<child1&>(t);
c.childf();
child2 d;
test(d);
}
int main (int argc, char **argv)
{
child1 c;
test (c);
return 0;
}
|