PR c++/85553
[official-gcc.git] / gcc / testsuite / g++.dg / other / pr29610.C
blobd68f4a15a07ce1bcdf80fb7c54f47698c0e5fcc7
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -funswitch-loops" } */
4 struct __normal_iterator 
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; }
11 struct string { ~string(){} };
12 struct vector 
14   int** _M_finish;
15   __normal_iterator end() const   { return __normal_iterator (_M_finish); }
16   int size() const   { return end().base() - end().base(); }
18 class Painter
20   int redraw_window(void);
21   typedef int (Painter::* SliceWindowFunc)(void);
22   int for_each(vector&, SliceWindowFunc);
23   void tcl_command(void);
25 inline int Painter::for_each(vector &layout, SliceWindowFunc func)
27     for (unsigned int window = 0; window < layout.size();++window)
28         (this->*func)();
29     return 0;
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)
37      for_each(*g(t2(2)), &Painter::redraw_window);