1// { dg-do compile } 2 3namespace std __attribute__ ((__visibility__ ("default"))) { 4 template<typename _Iterator> struct iterator_traits { 5 }; 6 template<typename _Tp> struct iterator_traits<_Tp*> { 7 typedef _Tp& reference; 8 }; 9} 10namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) { 11 using std::iterator_traits; 12 template<typename _Iterator, typename _Container> class __normal_iterator { 13 _Iterator _M_current; 14 typedef iterator_traits<_Iterator> __traits_type; 15 public: 16 typedef typename __traits_type::reference reference; 17 explicit __normal_iterator(const _Iterator& __i) : _M_current(__i) { 18 } 19 reference operator*() const { 20 return *_M_current; 21 } 22 __normal_iterator operator++(int) { 23 return __normal_iterator(_M_current++); 24 } 25 }; 26 template<typename _Tp> class new_allocator { 27 public: 28 typedef _Tp* pointer; 29 template<typename _Tp1> struct rebind { 30 typedef new_allocator<_Tp1> other; 31 }; 32 }; 33} 34namespace std __attribute__ ((__visibility__ ("default"))) { 35 template<typename _Tp> class allocator: public __gnu_cxx::new_allocator<_Tp> { 36 }; 37} 38namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) { 39 template<typename _Alloc> struct __alloc_traits { 40 typedef typename _Alloc::pointer pointer; 41 template<typename _Tp> struct rebind { 42 typedef typename _Alloc::template rebind<_Tp>::other other; 43 }; 44 }; 45} 46namespace std __attribute__ ((__visibility__ ("default"))) { 47 template<typename _Tp, typename _Alloc> struct _Vector_base { 48 typedef typename __gnu_cxx::__alloc_traits<_Alloc>::template rebind<_Tp>::other _Tp_alloc_type; 49 typedef typename __gnu_cxx::__alloc_traits<_Tp_alloc_type>::pointer pointer; 50 struct _Vector_impl : public _Tp_alloc_type { 51 pointer _M_start; 52 }; 53 _Vector_impl _M_impl; 54 }; 55 template<typename _Tp, typename _Alloc = std::allocator<_Tp> > class vector : protected _Vector_base<_Tp, _Alloc> { 56 typedef _Vector_base<_Tp, _Alloc> _Base; 57 public: 58 typedef typename _Base::pointer pointer; 59 typedef __gnu_cxx::__normal_iterator<pointer, vector> iterator; 60 iterator begin() { 61 return iterator(this->_M_impl._M_start); 62 } 63 }; 64} 65class myServer { 66 static std::vector<myServer *> server_list; 67 class Callback; 68 class myFolder *currentFolder; 69 static bool eventloop(Callback *); 70}; 71extern "C" { 72 typedef unsigned int uint32_t; 73 typedef uint32_t unicode_char; 74 extern int strcmp (__const char *__s1, __const char *__s2) throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); 75}; 76class CursesObj { 77}; 78class Curses : public CursesObj { 79public: 80 class Key { 81 public: 82 unicode_char ukey; 83 const char *keycode; 84 Key(unicode_char ch) : ukey(ch), keycode(0) { 85 } 86 bool plain() const { 87 } 88 bool nokey() const { 89 } 90 bool operator==(const Key &k) const { 91 return strcmp(keycode ? keycode: 92 "", k.keycode ? k.keycode: 93 "") == 0 && ukey == k.ukey; 94 } 95 }; 96 static bool processKey(const Key &k); 97}; 98class CursesContainer : public Curses { 99}; 100class myFolder { 101public: 102 void checkExpunged(); 103}; 104class Typeahead { 105public: 106 static Typeahead *typeahead; 107 bool empty() { 108 } 109 Curses::Key pop() { 110 } 111}; 112class CursesScreen : public CursesContainer { 113public: 114 Key getKey(); 115}; 116using namespace std; 117extern CursesScreen *cursesScreen; 118bool myServer::eventloop(myServer::Callback *callback) { 119 Curses::Key k1= (callback == __null && !Typeahead::typeahead->empty() ? Typeahead::typeahead->pop() : cursesScreen->getKey()); 120 if (callback == __null || (k1.plain() && k1.ukey == '\x03')) { 121 if (!k1.nokey()) { 122 bool rc=Curses::processKey(k1); 123 if (rc) { while (k1.plain() && k1 == '\x03' && !Typeahead::typeahead->empty()) Typeahead::typeahead->pop(); } 124 } 125 } 126 vector<myServer *>::iterator b=server_list.begin(); 127 while (1) { 128 myServer *p= *b++; 129 if (p->currentFolder) p->currentFolder->checkExpunged(); 130 } 131} 132