1 /* PR target/36745 */ 2 /* { dg-do compile } */ 3 /* { dg-options "-O2 -fPIC" } */ 4 /* { dg-additional-options "-Wno-return-type" } */ 5 /* { dg-require-effective-target fpic } */ 6 7 typedef __SIZE_TYPE__ size_t; 8 class QBasicAtomicInt 9 { 10 public: 11 int _q_value; 12 inline bool operator== (int value) const 13 { 14 } 15 bool ref (); 16 bool deref (); 17 }; 18 inline bool ref()19QBasicAtomicInt::ref () 20 { 21 __asm__ ("": "=m" (_q_value): :); 22 return true; 23 } 24 25 namespace std 26 { 27 using::size_t; 28 } 29 extern "C++" 30 { new(std::size_t,void * __p)31 inline void *operator new (std::size_t, void *__p) 32 { 33 return __p; 34 } 35 } 36 struct QMapData 37 { 38 QBasicAtomicInt ref; 39 static QMapData shared_null; 40 }; 41 template < class Key, class T > class QMap 42 { 43 QMapData *d; QMap()44public: inline QMap ():d (&QMapData::shared_null) 45 { 46 } ~QMap()47 inline ~ QMap () 48 { 49 if (!d->ref.deref ()) 50 freeData (d); 51 } 52 void freeData (QMapData * d); 53 }; 54 struct QVectorData 55 { 56 QBasicAtomicInt ref; 57 static QVectorData shared_null; 58 }; 59 template < typename T > struct QVectorTypedData 60 { 61 QBasicAtomicInt ref; 62 }; 63 template < typename T > class QVector 64 { 65 union 66 { 67 QVectorData *p; 68 QVectorTypedData < T > *d; 69 }; QVector()70public: inline QVector ():p (&QVectorData::shared_null) 71 { 72 d->ref.ref (); 73 } detach()74 inline void detach () 75 { 76 if (d->ref == 1) 77 detach_helper (); 78 } data()79 inline T *data () 80 { 81 detach (); 82 } 83 T & operator[](int i); 84 void detach_helper (); 85 void realloc (); 86 }; detach_helper()87template < typename T > void QVector < T >::detach_helper () 88 { 89 realloc (); 90 } 91 92 template < typename T > inline T & QVector < T >::operator[](int i) 93 { 94 return data ()[i]; 95 } realloc()96template < typename T > void QVector < T >::realloc () 97 { 98 T *j, *i; 99 i->~T (); 100 while (j-- == i) 101 new (j) T; 102 } 103 104 void mergeInto(QVector<int> * a)105mergeInto (QVector < int >*a) 106 { 107 }; 108 struct QRegExpAutomatonState 109 { 110 QVector < int >outs; 111 QMap < int, int >reenter; 112 QMap < int, int >anchors; 113 }; 114 class QRegExpEngine 115 { 116 void addCatTransitions (); 117 QVector < QRegExpAutomatonState > s; 118 }; 119 void addCatTransitions()120QRegExpEngine::addCatTransitions () 121 { 122 mergeInto (&s[2].outs); 123 } 124