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