| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O3 -fdump-ipa-cp" } */ |
| 3 |
/* { dg-add-options bind_pic_locally } */ |
| 4 |
|
| 5 |
struct data { |
| 6 |
data(int); |
| 7 |
}; |
| 8 |
|
| 9 |
struct top { |
| 10 |
virtual int topf(); |
| 11 |
}; |
| 12 |
|
| 13 |
struct intermediate: top { |
| 14 |
int topf() /* override */ { return 0; } |
| 15 |
}; |
| 16 |
|
| 17 |
struct child1: top { |
| 18 |
void childf() |
| 19 |
{ |
| 20 |
data d(topf()); |
| 21 |
} |
| 22 |
}; |
| 23 |
|
| 24 |
struct child2: intermediate {}; |
| 25 |
|
| 26 |
void test(top& t) |
| 27 |
{ |
| 28 |
child1& c = static_cast<child1&>(t); |
| 29 |
c.childf(); |
| 30 |
child2 d; |
| 31 |
test(d); |
| 32 |
} |
| 33 |
|
| 34 |
/* { dg-final { scan-ipa-dump "Type inconsistent devirtualization" "cp" } } */ |