| 1 |
// { dg-do compile } |
| 2 |
// { dg-options "-w" } |
| 3 |
|
| 4 |
class iplugin_factory; |
| 5 |
class idocument_plugin_factory { |
| 6 |
virtual idocument_plugin_factory *create_plugin(iplugin_factory &, int &); |
| 7 |
}; |
| 8 |
template <typename _Iterator, typename> class __normal_iterator { |
| 9 |
_Iterator _M_current; |
| 10 |
|
| 11 |
public: |
| 12 |
_Iterator iterator_type; |
| 13 |
__normal_iterator(const _Iterator &p1) : _M_current(p1) {} |
| 14 |
void operator++(); |
| 15 |
_Iterator &base() { return _M_current; } |
| 16 |
}; |
| 17 |
|
| 18 |
template <typename _IteratorL, typename _IteratorR, typename _Container> |
| 19 |
int operator!=(__normal_iterator<_IteratorL, _Container> &p1, |
| 20 |
__normal_iterator<_IteratorR, _Container> &p2) { |
| 21 |
return p1.base() != p2.base(); |
| 22 |
} |
| 23 |
|
| 24 |
class new_allocator { |
| 25 |
public: |
| 26 |
typedef int *const_pointer; |
| 27 |
int *allocate(); |
| 28 |
}; |
| 29 |
template <typename> class allocator : public new_allocator {}; |
| 30 |
|
| 31 |
class basic_string { |
| 32 |
public: |
| 33 |
basic_string(char *); |
| 34 |
}; |
| 35 |
struct __uninitialized_copy { |
| 36 |
template <typename _InputIterator, typename _ForwardIterator> |
| 37 |
static _ForwardIterator __uninit_copy(_InputIterator p1, _InputIterator p2, |
| 38 |
_ForwardIterator p3) try { |
| 39 |
for (; p1 != p2; ++p1, ++p3) |
| 40 |
; |
| 41 |
return p3; |
| 42 |
} |
| 43 |
catch (...) { |
| 44 |
} |
| 45 |
}; |
| 46 |
|
| 47 |
template <typename _InputIterator, typename _ForwardIterator> |
| 48 |
_ForwardIterator uninitialized_copy(_InputIterator p1, _InputIterator p2, |
| 49 |
_ForwardIterator p3) { |
| 50 |
return __uninitialized_copy::__uninit_copy(p1, p2, p3); |
| 51 |
} |
| 52 |
|
| 53 |
template <typename _InputIterator, typename _ForwardIterator, typename _Tp> |
| 54 |
_ForwardIterator __uninitialized_copy_a(_InputIterator p1, _InputIterator p2, |
| 55 |
_ForwardIterator p3, allocator<_Tp> &) { |
| 56 |
return uninitialized_copy(p1, p2, p3); |
| 57 |
} |
| 58 |
|
| 59 |
struct _Vector_base { |
| 60 |
struct _Vector_impl : allocator<int> { |
| 61 |
int *_M_start; |
| 62 |
int *_M_finish; |
| 63 |
}; |
| 64 |
allocator<int> &_M_get_Tp_allocator() {} |
| 65 |
_Vector_base() {} |
| 66 |
_Vector_base(int p1) { _M_create_storage(p1); } |
| 67 |
_Vector_impl _M_impl; |
| 68 |
int *_M_allocate(int p1) { p1 ? _M_impl.allocate() : 0; } |
| 69 |
void _M_create_storage(int p1) { |
| 70 |
this->_M_impl._M_start = this->_M_allocate(p1); |
| 71 |
} |
| 72 |
}; |
| 73 |
|
| 74 |
class vector : _Vector_base { |
| 75 |
_Vector_base _Base; |
| 76 |
|
| 77 |
public: |
| 78 |
vector() {} |
| 79 |
vector(const vector &p1) : _Base(p1.size()) { |
| 80 |
this->_M_impl._M_finish = __uninitialized_copy_a( |
| 81 |
p1.begin(), p1.end(), this->_M_impl._M_start, _M_get_Tp_allocator()); |
| 82 |
} |
| 83 |
~vector(); |
| 84 |
__normal_iterator<typename allocator<int>::const_pointer, int> begin() const { |
| 85 |
return this->_M_impl._M_start; |
| 86 |
} |
| 87 |
__normal_iterator<typename allocator<int>::const_pointer, int> end() const { |
| 88 |
return this->_M_impl._M_finish; |
| 89 |
} |
| 90 |
int size() const { return this->_M_impl._M_finish - this->_M_impl._M_start; } |
| 91 |
}; |
| 92 |
class iplugin_factory { |
| 93 |
public: |
| 94 |
typedef enum { |
| 95 |
STABLE, |
| 96 |
EXPERIMENTAL |
| 97 |
} quality_t; |
| 98 |
}; |
| 99 |
class plugin_factory : public iplugin_factory { |
| 100 |
public: |
| 101 |
plugin_factory(const int &, const basic_string &, const basic_string &, |
| 102 |
const basic_string &, quality_t); |
| 103 |
}; |
| 104 |
template <typename plugin_t> |
| 105 |
class document_plugin_factory : plugin_factory, idocument_plugin_factory { |
| 106 |
public: |
| 107 |
document_plugin_factory(const int &p1, const basic_string &, |
| 108 |
const basic_string &, const basic_string &, quality_t) |
| 109 |
: plugin_factory(0, 0, 0, 0, STABLE) {} |
| 110 |
idocument_plugin_factory *create_plugin(iplugin_factory &p1, int &p2) { |
| 111 |
plugin_t(p1, p2); |
| 112 |
} |
| 113 |
}; |
| 114 |
|
| 115 |
class container { |
| 116 |
public: |
| 117 |
template <typename init_t> container(init_t &); |
| 118 |
}; |
| 119 |
template <class init_t> class initializer_t : init_t { |
| 120 |
public: |
| 121 |
initializer_t(const init_t &p1) : init_t(p1) {} |
| 122 |
}; |
| 123 |
|
| 124 |
class composition_t {}; |
| 125 |
template <typename lhs_t, typename rhs_t> |
| 126 |
const initializer_t<composition_t> operator+(const initializer_t<lhs_t> &, |
| 127 |
const initializer_t<rhs_t> &); |
| 128 |
template <typename value_t> class value_initializer_t { |
| 129 |
public: |
| 130 |
value_initializer_t(const value_t &p1) : m_value(p1) {} |
| 131 |
value_t m_value; |
| 132 |
}; |
| 133 |
|
| 134 |
template <typename value_t> |
| 135 |
initializer_t<value_initializer_t<value_t> > init_value(const value_t &p1) { |
| 136 |
initializer_t<value_initializer_t<value_t> >( |
| 137 |
value_initializer_t<value_t>(p1)); |
| 138 |
} |
| 139 |
|
| 140 |
class name_t {}; |
| 141 |
class label_t {}; |
| 142 |
class description_t {}; |
| 143 |
class owner_initializer_t {}; |
| 144 |
template <typename owner_t> |
| 145 |
initializer_t<owner_initializer_t> init_owner(owner_t &); |
| 146 |
class set : vector {}; |
| 147 |
class node { |
| 148 |
public: |
| 149 |
node(iplugin_factory &, int &); |
| 150 |
}; |
| 151 |
initializer_t<name_t> init_name(); |
| 152 |
initializer_t<label_t> init_label(); |
| 153 |
initializer_t<description_t> init_description(); |
| 154 |
template <typename base_t> class mesh_selection_sink : base_t { |
| 155 |
public: |
| 156 |
mesh_selection_sink(iplugin_factory &p1, int &p2) |
| 157 |
: base_t(p1, p2), |
| 158 |
m_mesh_selection(init_owner(*this) + init_name() + init_label() + |
| 159 |
init_description() + init_value(set())) {} |
| 160 |
container m_mesh_selection; |
| 161 |
}; |
| 162 |
|
| 163 |
class selection_to_stdout : mesh_selection_sink<node> { |
| 164 |
public: |
| 165 |
selection_to_stdout(iplugin_factory &p1, int &p2) |
| 166 |
: mesh_selection_sink(p1, p2) {} |
| 167 |
static iplugin_factory &get_factory() { |
| 168 |
document_plugin_factory<selection_to_stdout>(0, "", 0, "", |
| 169 |
iplugin_factory::EXPERIMENTAL); |
| 170 |
} |
| 171 |
}; |
| 172 |
|
| 173 |
void selection_to_stdout_factory() { selection_to_stdout::get_factory(); } |