1 // { dg-do compile }
2 // { dg-additional-options "-Wno-return-type" }
3
4 namespace std __attribute__ ((__visibility__ ("default")))
5 {
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> >
11 class basic_string;
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;
20 };
21 template<typename _CharT, typename _Traits, typename _Alloc>
22 class basic_string {
23 public:
24 basic_string(const _CharT* __s, const _Alloc& __a = _Alloc());
25 };
26 class type_info {
27 public:
28 const char* name() const;
29 };
30 extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__gnu_inline__, __artificial__))
memcpy(void * __restrict __dest,__const void * __restrict __src,size_t __len)31 void * memcpy (void *__restrict __dest, __const void *__restrict __src, size_t __len) throw ()
32 {
33 return __builtin___memcpy_chk (__dest, __src, __len, __builtin_object_size (__dest, 0));
34 }
35 template <typename _Key, typename _Tp >
36 class map {
37 typedef _Key key_type;
38 typedef _Tp mapped_type;
39 public:
40 mapped_type& operator[](const key_type& __k);
41 };
42 }
43 class CodeAlloc { };
44 using namespace std;
45 typedef void *Stack;
46 class basicForEachType;
47 typedef const basicForEachType * aType;
48 extern map<const string,basicForEachType *> map_type;
49 class AnyTypeWithOutCheck { };
50 typedef AnyTypeWithOutCheck AnyType;
SetAny(const T & x)51 template<typename T> AnyTypeWithOutCheck inline SetAny(const T & x)
52 {
53 AnyTypeWithOutCheck any;
54 memcpy(&any,&x,sizeof(x));
55 }
56 template<typename T> const T& GetAny(const AnyTypeWithOutCheck & x);
57 class E_F0;
58 class C_F0;
59 class Polymorphic;
60 typedef E_F0 * Expression;
61 class basicAC_F0;
62 extern Polymorphic * TheOperators, * TheRightOperators;
63 class basicForEachType : public CodeAlloc {
64 public:
65 virtual C_F0 CastTo(const C_F0 & e) const ;
66 };
67 class E_F0 :public CodeAlloc {
68 public:
69 virtual AnyType operator()(Stack) const =0;
70 };
71 class E_F0mps : public E_F0 {
72 };
73 class ArrayOfaType : public CodeAlloc{
74 protected:
75 aType * t;
76 };
77 class OneOperator : public ArrayOfaType {
78 public:
79 OneOperator(aType rr,aType a,aType b);
80 virtual E_F0 * code(const basicAC_F0 &) const =0;
81 };
82 class Polymorphic: public E_F0mps {
83 public:
84 void Add(const char * op,OneOperator * p0 ,OneOperator * p1=0) const;
85 };
86 class C_F0 {
87 public:
88 operator E_F0 * () const;
89 };
90 class basicAC_F0 {
91 public:
92 const C_F0 & operator [] (int i) const;
93 };
94 struct OneBinaryOperatorMI { };
95 struct evalE_F2 { };
96 template<typename C,class MI=OneBinaryOperatorMI,class MIx=evalE_F2 >
97 class OneBinaryOperator : public OneOperator
98 {
99 typedef typename C::result_type R;
100 typedef typename C::first_argument_type A;
101 typedef typename C::second_argument_type B;
102 aType t0,t1;
103 class Op : public E_F0 {
104 Expression a,b;
105 public:
operator()106 AnyType operator()(Stack s) const {
107 return SetAny<R>(static_cast<R>(C::f( GetAny<A>((*a)(s)),
108 GetAny<B>((*b)(s)))));
109 }
Op(Expression aa,Expression bb)110 Op(Expression aa,Expression bb) : a(aa),b(bb) { }
111 };
112 public:
code(const basicAC_F0 & args)113 E_F0 * code(const basicAC_F0 & args) const {
114 return new Op(t0->CastTo(args[0]),t1->CastTo(args[1]));
115 }
OneBinaryOperator()116 OneBinaryOperator()
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]) { }
120 };
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> >
127 {
128 static KN_<K> f(const KN_<K> & a, pair<KN_<K>, KN_<L> > * const & b);
129 };
130 template<class K,class L,class OP> struct set_AI_B
131 : public binary_function<pair<KN_<K>, KN_<L> > * ,KN_<K>, NothingType >
132 {
133 static NothingType f( pair<KN_<K>, KN_<L> > * const & b,const KN_<K> & a);
134 };
ArrayOperator()135 template<class K,class Z> void ArrayOperator()
136 {
137 TheOperators->Add("=", new OneBinaryOperator<set_A_BI< K,Z,affectation<K> > >,
138 new OneBinaryOperator<set_AI_B< K,Z,affectation<K> > >);
139 }
initArrayOperatorlong()140 void initArrayOperatorlong() {
141 ArrayOperator<long,long>();
142 }
143