| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O2 -funswitch-loops" } */ |
| 3 |
|
| 4 |
struct __normal_iterator |
| 5 |
{ |
| 6 |
typedef int*const *_Iterator; |
| 7 |
int*const * _M_current; |
| 8 |
__normal_iterator(const _Iterator& __i) : _M_current(__i){} |
| 9 |
const _Iterator& base() const { static _Iterator a; return a; } |
| 10 |
}; |
| 11 |
struct string { ~string(){} }; |
| 12 |
struct vector |
| 13 |
{ |
| 14 |
int** _M_finish; |
| 15 |
__normal_iterator end() const { return __normal_iterator (_M_finish); } |
| 16 |
int size() const { return end().base() - end().base(); } |
| 17 |
}; |
| 18 |
class Painter |
| 19 |
{ |
| 20 |
int redraw_window(void); |
| 21 |
typedef int (Painter::* SliceWindowFunc)(void); |
| 22 |
int for_each(vector&, SliceWindowFunc); |
| 23 |
void tcl_command(void); |
| 24 |
}; |
| 25 |
inline int Painter::for_each(vector &layout, SliceWindowFunc func) |
| 26 |
{ |
| 27 |
for (unsigned int window = 0; window < layout.size();++window) |
| 28 |
(this->*func)(); |
| 29 |
return 0; |
| 30 |
} |
| 31 |
int t; |
| 32 |
int Painter::redraw_window(void) {t = 1; return 0; } |
| 33 |
string t2(int); |
| 34 |
vector *g(const string&); |
| 35 |
void Painter::tcl_command(void) |
| 36 |
{ |
| 37 |
for_each(*g(t2(2)), &Painter::redraw_window); |
| 38 |
} |
| 39 |
|