summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/torture/pr36745.C
blob: 53845aaa78e28afa0eafbd6e60487f5e09a18574 (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
/* PR target/36745 */
/* { dg-do compile } */
/* { dg-options "-O2 -fPIC" } */
/* { dg-require-effective-target fpic } */

typedef __SIZE_TYPE__ size_t;
class QBasicAtomicInt
{
public:
  int _q_value;
  inline bool operator== (int value) const
  {
  }
  bool ref ();
  bool deref ();
};
inline bool
QBasicAtomicInt::ref ()
{
  __asm__ ("": "=m" (_q_value): :);
  return true;
}

namespace std
{
  using::size_t;
}
extern "C++"
{
  inline void *operator new (std::size_t, void *__p)
  {
    return __p;
  }
}
struct QMapData
{
  QBasicAtomicInt ref;
  static QMapData shared_null;
};
template < class Key, class T > class QMap
{
  QMapData *d;
public: inline QMap ():d (&QMapData::shared_null)
  {
  }
  inline ~ QMap ()
  {
    if (!d->ref.deref ())
      freeData (d);
  }
  void freeData (QMapData * d);
};
struct QVectorData
{
  QBasicAtomicInt ref;
  static QVectorData shared_null;
};
template < typename T > struct QVectorTypedData
{
  QBasicAtomicInt ref;
};
template < typename T > class QVector
{
  union
  {
    QVectorData *p;
    QVectorTypedData < T > *d;
  };
public: inline QVector ():p (&QVectorData::shared_null)
  {
    d->ref.ref ();
  }
  inline void detach ()
  {
    if (d->ref == 1)
      detach_helper ();
  }
  inline T *data ()
  {
    detach ();
  }
  T & operator[](int i);
  void detach_helper ();
  void realloc ();
};
template < typename T > void QVector < T >::detach_helper ()
{
  realloc ();
}

template < typename T > inline T & QVector < T >::operator[](int i)
{
  return data ()[i];
}
template < typename T > void QVector < T >::realloc ()
{
  T *j, *i;
  i->~T ();
  while (j-- == i)
    new (j) T;
}

void
mergeInto (QVector < int >*a)
{
};
struct QRegExpAutomatonState
{
  QVector < int >outs;
  QMap < int, int >reenter;
  QMap < int, int >anchors;
};
class QRegExpEngine
{
  void addCatTransitions ();
  QVector < QRegExpAutomatonState > s;
};
void
QRegExpEngine::addCatTransitions ()
{
  mergeInto (&s[2].outs);
}