2 // { dg-additional-options "-Wno-return-type" }
4 namespace std __attribute__ ((__visibility__ ("default")))
6 typedef __SIZE_TYPE__ size_t;
7 template<typename _Alloc> class allocator;
8 template<class _CharT> struct char_traits;
9 template<typename _CharT, typename _Traits = char_traits<_CharT>,
10 typename _Alloc = allocator<_CharT> >
12 typedef basic_string<char> string;
13 template<class _T1, class _T2> struct pair { };
14 template<typename _Tp> class allocator { };
15 template<typename _Arg1, typename _Arg2, typename _Result>
16 struct binary_function {
17 typedef _Arg1 first_argument_type;
18 typedef _Arg2 second_argument_type;
19 typedef _Result result_type;
21 template<typename _CharT, typename _Traits, typename _Alloc>
24 basic_string(const _CharT* __s, const _Alloc& __a = _Alloc());
28 const char* name() const;
30 extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__gnu_inline__, __artificial__))
31 void * memcpy (void *__restrict __dest, __const void *__restrict __src, size_t __len) throw ()
33 return __builtin___memcpy_chk (__dest, __src, __len, __builtin_object_size (__dest, 0));
35 template <typename _Key, typename _Tp >
37 typedef _Key key_type;
38 typedef _Tp mapped_type;
40 mapped_type& operator[](const key_type& __k);
46 class basicForEachType;
47 typedef const basicForEachType * aType;
48 extern map<const string,basicForEachType *> map_type;
49 class AnyTypeWithOutCheck { };
50 typedef AnyTypeWithOutCheck AnyType;
51 template<typename T> AnyTypeWithOutCheck inline SetAny(const T & x)
53 AnyTypeWithOutCheck any;
54 memcpy(&any,&x,sizeof(x));
56 template<typename T> const T& GetAny(const AnyTypeWithOutCheck & x);
60 typedef E_F0 * Expression;
62 extern Polymorphic * TheOperators, * TheRightOperators;
63 class basicForEachType : public CodeAlloc {
65 virtual C_F0 CastTo(const C_F0 & e) const ;
67 class E_F0 :public CodeAlloc {
69 virtual AnyType operator()(Stack) const =0;
71 class E_F0mps : public E_F0 {
73 class ArrayOfaType : public CodeAlloc{
77 class OneOperator : public ArrayOfaType {
79 OneOperator(aType rr,aType a,aType b);
80 virtual E_F0 * code(const basicAC_F0 &) const =0;
82 class Polymorphic: public E_F0mps {
84 void Add(const char * op,OneOperator * p0 ,OneOperator * p1=0) const;
88 operator E_F0 * () const;
92 const C_F0 & operator [] (int i) const;
94 struct OneBinaryOperatorMI { };
96 template<typename C,class MI=OneBinaryOperatorMI,class MIx=evalE_F2 >
97 class OneBinaryOperator : public OneOperator
99 typedef typename C::result_type R;
100 typedef typename C::first_argument_type A;
101 typedef typename C::second_argument_type B;
103 class Op : public E_F0 {
106 AnyType operator()(Stack s) const {
107 return SetAny<R>(static_cast<R>(C::f( GetAny<A>((*a)(s)),
108 GetAny<B>((*b)(s)))));
110 Op(Expression aa,Expression bb) : a(aa),b(bb) { }
113 E_F0 * code(const basicAC_F0 & args) const {
114 return new Op(t0->CastTo(args[0]),t1->CastTo(args[1]));
117 : OneOperator(map_type[typeid(R).name()],
118 map_type[typeid(A).name()],
119 map_type[typeid(B).name()]), t0(t[0]), t1(t[1]) { }
121 struct NothingType { };
122 class ShapeOfArray{ };
123 template<class R> class KN_: public ShapeOfArray { };
124 template <class T> struct affectation: binary_function<T, T, T> { };
125 template<class K,class L,class OP> struct set_A_BI
126 : public binary_function<KN_<K>,pair<KN_<K>, KN_<L> > *,KN_<K> >
128 static KN_<K> f(const KN_<K> & a, pair<KN_<K>, KN_<L> > * const & b);
130 template<class K,class L,class OP> struct set_AI_B
131 : public binary_function<pair<KN_<K>, KN_<L> > * ,KN_<K>, NothingType >
133 static NothingType f( pair<KN_<K>, KN_<L> > * const & b,const KN_<K> & a);
135 template<class K,class Z> void ArrayOperator()
137 TheOperators->Add("=", new OneBinaryOperator<set_A_BI< K,Z,affectation<K> > >,
138 new OneBinaryOperator<set_AI_B< K,Z,affectation<K> > >);
140 void initArrayOperatorlong() {
141 ArrayOperator<long,long>();