| 1 |
// PR middle-end/87916 |
| 2 |
// Testcase by Martin Liška <[email protected]> |
| 3 |
|
| 4 |
// { dg-do compile } |
| 5 |
// { dg-options "-O2 -g" } |
| 6 |
// { dg-additional-options "-fPIC" { target fpic } } |
| 7 |
|
| 8 |
struct a { |
| 9 |
virtual ~a(); |
| 10 |
}; |
| 11 |
template <typename b> class c { |
| 12 |
public: |
| 13 |
class d { |
| 14 |
public: |
| 15 |
d(c); |
| 16 |
b *operator->(); |
| 17 |
}; |
| 18 |
}; |
| 19 |
int e, f; |
| 20 |
class g { |
| 21 |
public: |
| 22 |
class h { |
| 23 |
public: |
| 24 |
virtual void j(g &, int &, bool) = 0; |
| 25 |
}; |
| 26 |
c<h> k(); |
| 27 |
int *l(); |
| 28 |
int *m(); |
| 29 |
}; |
| 30 |
int *g::l() try { |
| 31 |
for (c<h>::d i(k());;) |
| 32 |
i->j(*this, e, true); |
| 33 |
} catch (int) { |
| 34 |
return 0; |
| 35 |
} |
| 36 |
int *g::m() try { |
| 37 |
for (c<h>::d i(k());;) |
| 38 |
i->j(*this, f, false); |
| 39 |
} catch (int) { |
| 40 |
return 0; |
| 41 |
} |
| 42 |
struct n : a, g::h { |
| 43 |
void o(); |
| 44 |
void j(g &, int &, bool) { o(); } |
| 45 |
}; |