| 1 |
// { dg-do assemble } |
| 2 |
// { dg-options "-O" } |
| 3 |
|
| 4 |
class foo { |
| 5 |
public: |
| 6 |
operator const char*() const { return a; } |
| 7 |
char *a; |
| 8 |
}; |
| 9 |
|
| 10 |
class bar { |
| 11 |
public: |
| 12 |
~bar(); |
| 13 |
void operator++(int); |
| 14 |
bool b() const; |
| 15 |
protected: |
| 16 |
void* c() const; |
| 17 |
}; |
| 18 |
|
| 19 |
class baz : public bar { |
| 20 |
public: |
| 21 |
foo const &d() const { return *(foo *)bar::c(); } |
| 22 |
}; |
| 23 |
|
| 24 |
extern int tst (const char *, const char *) throw(); |
| 25 |
|
| 26 |
void die(const foo& x) |
| 27 |
{ |
| 28 |
for (baz hi; hi.b(); hi++) |
| 29 |
if (tst (hi.d(), x) == 0) |
| 30 |
return; |
| 31 |
} |