blob: 4d0db6be44ced1b4a614b54d4a4f223e611af9f0 (
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
|
/* { dg-do compile } */
/* { dg-options "-O3 -fdump-ipa-cp -fdevirtualize" } */
struct data {
data(int);
};
struct top {
virtual int topf();
};
struct intermediate: top {
int topf() /* override */ { return 0; }
};
struct child1: top {
__attribute__((noinline)) void childf()
{
data d(topf());
}
};
struct child2: intermediate {};
void test(top& t)
{
child1& c = static_cast<child1&>(t);
c.childf();
child2 d;
test(d);
}
/* { dg-final { scan-ipa-dump "Type inconsistent devirtualization" "cp" } } */
/* { dg-final { cleanup-ipa-dump "cp" } } */
|