| 1 |
// PR middle-end/60419 |
| 2 |
// { dg-do compile } |
| 3 |
// { dg-options "-O2" } |
| 4 |
|
| 5 |
struct C |
| 6 |
{ |
| 7 |
}; |
| 8 |
|
| 9 |
struct I : C |
| 10 |
{ |
| 11 |
I (); |
| 12 |
}; |
| 13 |
|
| 14 |
struct J |
| 15 |
{ |
| 16 |
void foo (); |
| 17 |
J (); |
| 18 |
virtual void foo (int &, int); |
| 19 |
}; |
| 20 |
|
| 21 |
template <class> |
| 22 |
struct D |
| 23 |
{ |
| 24 |
virtual void foo (I &) const; |
| 25 |
void bar () |
| 26 |
{ |
| 27 |
I p; |
| 28 |
foo (p); |
| 29 |
} |
| 30 |
}; |
| 31 |
|
| 32 |
struct K : J, public D<int> |
| 33 |
{ |
| 34 |
}; |
| 35 |
|
| 36 |
struct F |
| 37 |
{ |
| 38 |
K *operator->(); |
| 39 |
}; |
| 40 |
|
| 41 |
struct N : public K |
| 42 |
{ |
| 43 |
void foo (int &, int); |
| 44 |
I n; |
| 45 |
void foo (I &) const {} |
| 46 |
}; |
| 47 |
|
| 48 |
struct L : J |
| 49 |
{ |
| 50 |
F l; |
| 51 |
}; |
| 52 |
|
| 53 |
struct M : F |
| 54 |
{ |
| 55 |
L *operator->(); |
| 56 |
}; |
| 57 |
|
| 58 |
struct G |
| 59 |
{ |
| 60 |
G (); |
| 61 |
}; |
| 62 |
|
| 63 |
M h; |
| 64 |
|
| 65 |
G::G () |
| 66 |
try |
| 67 |
{ |
| 68 |
N f; |
| 69 |
f.bar (); |
| 70 |
throw; |
| 71 |
} |
| 72 |
catch (int) |
| 73 |
{ |
| 74 |
} |
| 75 |
|
| 76 |
void |
| 77 |
baz () |
| 78 |
{ |
| 79 |
h->l->bar (); |
| 80 |
} |