Fortran: Fix PR 47485.
[gcc.git] / gcc / testsuite / g++.dg / torture / pr51959.C
blob1c98f4f6cc8775a6ff5a881ecaf7ca3d086d6959
1 // { dg-do compile }
2 // { dg-additional-options "-Wno-return-type" }
4 namespace std {
5     typedef __SIZE_TYPE__ size_t;
7 inline void* operator new(std::size_t, void* __p) throw() {
8     return __p;
10 template <typename T> class QTypeInfo {
12 enum { Q_COMPLEX_TYPE = 0,     Q_PRIMITIVE_TYPE = 0x1,     Q_STATIC_TYPE = 0,     Q_MOVABLE_TYPE = 0x2,     Q_DUMMY_TYPE = 0x4 };
13 template<typename Enum> class QFlags {
14     int i;
15     inline QFlags(Enum f) : i(f) { }
17 class __attribute__((visibility("default"))) QSize {
18 public:
19     bool isEmpty() const;
20     friend inline bool operator==(const QSize &, const QSize &);
21     int wd;
22     int ht;
24 template<> class QTypeInfo<QSize > {
25 public:
26     enum {
27         isComplex = (((Q_MOVABLE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_MOVABLE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isLarge = (sizeof(QSize)>sizeof(void*)), isPointer = false, isDummy = (((Q_MOVABLE_TYPE) & Q_DUMMY_TYPE) != 0) };
29 class __attribute__((visibility("default"))) QBasicAtomicInt {
30 public:
31     inline bool operator!=(int value) const     { }
33 struct __attribute__((visibility("default"))) QListData {
34     struct Data {
35         QBasicAtomicInt ref;
36     };
37     void **append();
39 template <typename T> class QList {
40     struct Node {
41         void *v;
42     };
43     union {
44         QListData p;
45         QListData::Data *d;
46     };
47 public:
48     void append(const T &t);
49     inline void push_back(const T &t) {
50         append(t);
51     }
52     void node_construct(Node *n, const T &t);
53     void node_destruct(Node *n);
55 template <typename T> inline void QList<T>::node_construct(Node *n, const T &t) {
56     if (QTypeInfo<T>::isLarge || QTypeInfo<T>::isStatic) n->v = new T(t);
57     else if (QTypeInfo<T>::isComplex) new (n) T(t);
59 template <typename T> inline void QList<T>::node_destruct(Node *n) {
61 template <typename T>  void QList<T>::append(const T &t) {
62     if (d->ref != 1) {
63         try {
64         }
65         catch (...) {
66         }
67         if (QTypeInfo<T>::isLarge || QTypeInfo<T>::isStatic) {
68         }
69         else {
70             Node *n, copy;
71             node_construct(&copy, t);
72             try {                 n = reinterpret_cast<Node *>(p.append());;             }
73             catch (...) {                 node_destruct(&copy);                 throw;             }
74             *n = copy;
75         }
76     }
78 void virtual_hook(QSize sz, QList<QSize> &arg)
80   arg.push_back(sz);