| 1 |
// { dg-do compile } |
| 2 |
class A { |
| 3 |
virtual unsigned long write(const char *, unsigned long); |
| 4 |
}; |
| 5 |
char *a; |
| 6 |
int b; |
| 7 |
bool c; |
| 8 |
char e[16]; |
| 9 |
class B { |
| 10 |
public: |
| 11 |
void push_range(const char *); |
| 12 |
}; |
| 13 |
class C : A { |
| 14 |
B m_string; |
| 15 |
|
| 16 |
public: |
| 17 |
unsigned long write(const char *p1, unsigned long p2) { |
| 18 |
m_string.push_range(p1 + p2); |
| 19 |
return 0; |
| 20 |
} |
| 21 |
}; |
| 22 |
char *write_signed_decimal_backward(bool) { |
| 23 |
char *d = 0; |
| 24 |
if (b) { |
| 25 |
if (c) |
| 26 |
--a; |
| 27 |
d = a; |
| 28 |
} |
| 29 |
return d; |
| 30 |
} |
| 31 |
|
| 32 |
template <typename TextOutputStreamType> |
| 33 |
void ostream_write(TextOutputStreamType &p1) { |
| 34 |
char *f = write_signed_decimal_backward(false); |
| 35 |
p1.write(f, e - f); |
| 36 |
} |
| 37 |
|
| 38 |
void operator<<(C p1, int) { ostream_write(p1); } |