| 1 |
// PR rtl-optimization/100254 |
| 2 |
// { dg-do compile } |
| 3 |
// { dg-options "-O2 -fno-guess-branch-probability -fipa-pta -fnon-call-exceptions -fcompare-debug" } |
| 4 |
// { dg-additional-options "-mtune=goldmont" { target i?86-*-* x86_64-*-* } } |
| 5 |
|
| 6 |
struct _Rb_tree_node_base { |
| 7 |
typedef _Rb_tree_node_base *_Base_ptr; |
| 8 |
typedef _Rb_tree_node_base *_Const_Base_ptr; |
| 9 |
_Base_ptr _M_left; |
| 10 |
}; |
| 11 |
template <typename _Key_compare> struct _Rb_tree_key_compare { |
| 12 |
_Key_compare _M_key_compare; |
| 13 |
}; |
| 14 |
struct _Rb_tree_header { |
| 15 |
_Rb_tree_node_base _M_header; |
| 16 |
}; |
| 17 |
struct _Rb_tree_iterator { |
| 18 |
_Rb_tree_iterator(_Rb_tree_node_base::_Base_ptr); |
| 19 |
friend bool operator==(_Rb_tree_iterator, _Rb_tree_iterator); |
| 20 |
}; |
| 21 |
template <typename _Tp> struct _Rb_tree_const_iterator { |
| 22 |
typedef _Rb_tree_const_iterator _Self; |
| 23 |
_Rb_tree_const_iterator(_Rb_tree_node_base::_Const_Base_ptr) {} |
| 24 |
_Tp operator*(); |
| 25 |
template <typename _Up> |
| 26 |
friend bool operator!=(_Rb_tree_const_iterator<_Up>, _Rb_tree_const_iterator<_Up>); |
| 27 |
}; |
| 28 |
template <typename _Key, typename _Val, typename _Compare> struct _Rb_tree { |
| 29 |
template <typename _Key_compare> |
| 30 |
struct _Rb_tree_impl : _Rb_tree_key_compare<_Key_compare>, _Rb_tree_header {}; |
| 31 |
_Rb_tree_impl<_Compare> _M_impl; |
| 32 |
_Key _S_key(); |
| 33 |
typedef _Rb_tree_const_iterator<_Val> const_iterator; |
| 34 |
const_iterator begin() { return _M_impl._M_header._M_left; } |
| 35 |
_Rb_tree_iterator find(const _Key &); |
| 36 |
}; |
| 37 |
template <typename _Key, typename _Val, typename _Compare> |
| 38 |
_Rb_tree_iterator _Rb_tree<_Key, _Val, _Compare>::find(const _Key &__k) { |
| 39 |
_Rb_tree_iterator __j = 0; |
| 40 |
return __j == 0 || _M_impl._M_key_compare(__k, _S_key()) ? 0 : __j; |
| 41 |
} |
| 42 |
template <typename _Key, typename _Compare = _Key> struct set { |
| 43 |
typedef _Key key_type; |
| 44 |
typedef _Rb_tree<key_type, _Key, _Compare> _Rep_type; |
| 45 |
_Rep_type _M_t; |
| 46 |
typedef typename _Rep_type::const_iterator iterator; |
| 47 |
iterator begin() { return _M_t.begin(); } |
| 48 |
iterator end(); |
| 49 |
void find(key_type __x) { _M_t.find(__x); } |
| 50 |
}; |
| 51 |
struct WindowDesc { |
| 52 |
WindowDesc(short); |
| 53 |
} _station_view_desc(0); |
| 54 |
struct Window { |
| 55 |
void IsWidgetLowered(); |
| 56 |
virtual void OnClick(int, int, int); |
| 57 |
}; |
| 58 |
int AllocateWindowDescFront_window_number; |
| 59 |
template <typename Wcls> void AllocateWindowDescFront(WindowDesc *desc, bool) { |
| 60 |
Wcls(desc, AllocateWindowDescFront_window_number); |
| 61 |
} |
| 62 |
class CargoDataEntry; |
| 63 |
struct CargoSorter { |
| 64 |
bool operator()(const CargoDataEntry *, const CargoDataEntry *) const; |
| 65 |
}; |
| 66 |
struct CargoDataEntry { |
| 67 |
~CargoDataEntry(); |
| 68 |
char Retrieve_cargo; |
| 69 |
void Retrieve() { |
| 70 |
CargoDataEntry t(Retrieve_cargo); |
| 71 |
children->find(&t); |
| 72 |
} |
| 73 |
CargoDataEntry(char); |
| 74 |
set<CargoDataEntry *, CargoSorter> *children; |
| 75 |
}; |
| 76 |
CargoDataEntry::CargoDataEntry(char) : children() {} |
| 77 |
CargoDataEntry::~CargoDataEntry() { |
| 78 |
if (children) |
| 79 |
for (set<CargoDataEntry *>::iterator i = children->begin(); |
| 80 |
i != children->end();) |
| 81 |
delete *i; |
| 82 |
} |
| 83 |
bool CargoSorter::operator()(const CargoDataEntry *, |
| 84 |
const CargoDataEntry *) const { return false; } |
| 85 |
struct StationViewWindow : Window { |
| 86 |
StationViewWindow(WindowDesc *, int); |
| 87 |
CargoDataEntry HandleCargoWaitingClick_filter; |
| 88 |
void OnClick(int, int widget, int) { |
| 89 |
switch (widget) { |
| 90 |
case 0: |
| 91 |
HandleCargoWaitingClick_filter.Retrieve(); |
| 92 |
HandleCargoWaitingClick_filter.Retrieve(); |
| 93 |
case 1: |
| 94 |
IsWidgetLowered(); |
| 95 |
} |
| 96 |
} |
| 97 |
}; |
| 98 |
void ShowStationViewWindow_station() { |
| 99 |
AllocateWindowDescFront<StationViewWindow>(&_station_view_desc, |
| 100 |
ShowStationViewWindow_station); |
| 101 |
} |