summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/torture/pr45877.C
blob: 9af6ae999852fcc88828b72ceea0feeccd953bb3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
// { dg-do compile }

namespace std __attribute__ ((__visibility__ ("default")))
{
  typedef __SIZE_TYPE__ size_t;
  template<typename _Alloc>     class allocator;
  template<class _CharT>     struct char_traits;
  template<typename _CharT, typename _Traits = char_traits<_CharT>,
      typename _Alloc = allocator<_CharT> >
	  class basic_string;
  typedef basic_string<char> string;
  template<class _T1, class _T2>     struct pair     { };
  template<typename _Tp>     class allocator    { };
  template<typename _Arg1, typename _Arg2, typename _Result>
      struct binary_function     {
	  typedef _Arg1 first_argument_type;
	  typedef _Arg2 second_argument_type;
	  typedef _Result result_type;
      };
  template<typename _CharT, typename _Traits, typename _Alloc>
  class basic_string {
  public:
      basic_string(const _CharT* __s, const _Alloc& __a = _Alloc());
  };
  class type_info   {
  public:
      const char* name() const;
  };
  extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__gnu_inline__, __artificial__))
  void * memcpy (void *__restrict __dest, __const void *__restrict __src, size_t __len) throw ()
  {
      return __builtin___memcpy_chk (__dest, __src, __len, __builtin_object_size (__dest, 0));
  }
  template <typename _Key, typename _Tp >
  class map {
      typedef _Key key_type;
      typedef _Tp mapped_type;
  public:
      mapped_type&       operator[](const key_type& __k);
  };
}
class CodeAlloc { };
using namespace std;
typedef void *Stack;
class basicForEachType;
typedef const basicForEachType * aType;
extern map<const string,basicForEachType *> map_type;
class AnyTypeWithOutCheck { };
typedef AnyTypeWithOutCheck AnyType;
template<typename T> AnyTypeWithOutCheck inline SetAny(const T & x)
{
  AnyTypeWithOutCheck any;
  memcpy(&any,&x,sizeof(x));
}
template<typename T> const T& GetAny(const AnyTypeWithOutCheck & x);
class E_F0;
class C_F0;
class Polymorphic;
typedef E_F0 * Expression;
class basicAC_F0;
extern Polymorphic * TheOperators, * TheRightOperators;
class basicForEachType : public CodeAlloc {
public:
    virtual C_F0 CastTo(const C_F0 & e) const ;
};
class E_F0 :public CodeAlloc    {
public:
    virtual AnyType operator()(Stack) const =0;
};
class E_F0mps : public E_F0 {
};
class ArrayOfaType : public CodeAlloc{
protected:
    aType * t;
};
class OneOperator : public ArrayOfaType {
public:
    OneOperator(aType rr,aType a,aType b);
    virtual E_F0 * code(const basicAC_F0 &) const =0;
};
class Polymorphic: public E_F0mps {
public:
    void Add(const char * op,OneOperator * p0 ,OneOperator * p1=0) const;
};
class C_F0 {
public:
    operator E_F0 * () const;
};
class basicAC_F0 {
public:
    const C_F0 & operator [] (int i) const;
};
struct OneBinaryOperatorMI { };
struct evalE_F2 { };
template<typename C,class MI=OneBinaryOperatorMI,class MIx=evalE_F2 >
class OneBinaryOperator : public OneOperator
{
  typedef typename C::result_type R;
  typedef typename C::first_argument_type A;
  typedef typename C::second_argument_type B;
  aType t0,t1;
  class Op : public E_F0 {
      Expression a,b;
  public:
      AnyType operator()(Stack s) const {
	  return SetAny<R>(static_cast<R>(C::f( GetAny<A>((*a)(s)),
						GetAny<B>((*b)(s)))));
      }
      Op(Expression aa,Expression bb) : a(aa),b(bb) { }
  };
public:
  E_F0 * code(const basicAC_F0 & args) const   {
      return new Op(t0->CastTo(args[0]),t1->CastTo(args[1]));
  }
  OneBinaryOperator()
      : OneOperator(map_type[typeid(R).name()],
		    map_type[typeid(A).name()],
		    map_type[typeid(B).name()]), t0(t[0]), t1(t[1]) { }
};
struct NothingType { };
class ShapeOfArray{ };
template<class R> class KN_: public ShapeOfArray { };
template <class T> struct affectation: binary_function<T, T, T> { };
template<class K,class L,class OP> struct set_A_BI
: public binary_function<KN_<K>,pair<KN_<K>, KN_<L> > *,KN_<K> >
{
  static KN_<K> f(const KN_<K> & a, pair<KN_<K>, KN_<L> > * const & b);
};
template<class K,class L,class OP> struct set_AI_B
: public binary_function<pair<KN_<K>, KN_<L> > * ,KN_<K>, NothingType >
{
  static NothingType f( pair<KN_<K>, KN_<L> > * const & b,const KN_<K> & a);
};
template<class K,class Z> void ArrayOperator()
{
  TheOperators->Add("=", new OneBinaryOperator<set_A_BI< K,Z,affectation<K> > >,
		    new OneBinaryOperator<set_AI_B< K,Z,affectation<K> > >);
}
void initArrayOperatorlong() {
    ArrayOperator<long,long>();
}