| 1 |
// PR tree-optimization/22488 |
| 2 |
// This testcase is really a C++ FE bug in represnting virtual inheritance |
| 3 |
// It gives the appearance to the middle end that the fields exist twice |
| 4 |
// which resulted in a very confused structure analyzer |
| 5 |
// { dg-do compile } |
| 6 |
// { dg-options "-O" } |
| 7 |
struct X |
| 8 |
{ |
| 9 |
int i0, i1; |
| 10 |
char c; |
| 11 |
}; |
| 12 |
|
| 13 |
struct A |
| 14 |
{ |
| 15 |
int i; |
| 16 |
char c0, c1; |
| 17 |
|
| 18 |
virtual ~A(); |
| 19 |
}; |
| 20 |
|
| 21 |
struct B : virtual A {}; |
| 22 |
|
| 23 |
struct C : B |
| 24 |
{ |
| 25 |
X x; |
| 26 |
|
| 27 |
void bar(X y) { x = y; } |
| 28 |
}; |
| 29 |
|
| 30 |
void foo() |
| 31 |
{ |
| 32 |
C().bar(X()); |
| 33 |
} |