OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.old-deja/] [g++.brendan/] [crash56.C] - Blame information for rev 749

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 699 jeremybenn
// { dg-do assemble  }
2
// { dg-options "-Wno-deprecated" }
3
// GROUPS passed old-abort
4
 
5
const bool FALSE = 0;
6
const bool TRUE = 1;
7
class ListDProto {
8
protected:
9
    class link;
10
public:
11
    ListDProto();
12
    ListDProto(const ListDProto&);
13
    virtual ~ListDProto();
14
    void operator=(const ListDProto&);
15
    unsigned length() const;
16
    bool empty() const;
17
    void clear();
18
    void remove_head();
19
    void remove_tail();
20
    class Vix {
21
    public:
22
        Vix();
23
        friend int operator==(void *v, const Vix& x)
24
            { return v == x.item; }
25
        friend int operator==(const Vix& x, void *v)
26
            { return v == x.item; }
27
        friend int operator!=(void *v, const Vix& x)
28
            { return v != x.item; }
29
        friend int operator!=(const Vix& x, void *v)
30
            { return v != x.item; }
31
        friend int operator==(const Vix& x1, const Vix& x2)
32
            { return x1.owner == x2.owner && x1.item == x2.item; }
33
        friend int operator!=(const Vix& x1, const Vix& x2)
34
            { return x1.owner != x2.owner || x1.item != x2.item; }
35
        bool first;
36
        bool last;
37
    protected:
38
        friend class ListDProto;
39
        Vix(const ListDProto *o, link *i);
40
        const ListDProto *owner;
41
    private:
42
        link *item;
43
    };
44
    enum Action { NORMAL, REMOVE_CURRENT };
45
    Vix first() const;
46
    void first(Vix& x) const;
47
    void next(Vix& x) const;
48
    void next(Vix& x, Action a = NORMAL);
49
    Vix last() const;
50
    void last(Vix& x) const;
51
    void prev(Vix& x) const;
52
    void prev(Vix& x, Action a = NORMAL);
53
protected:
54
    struct link {
55
        link *next;
56
        link *prev;
57
        link(link *n = 0, link *p = 0);
58
        virtual ~link();
59
    private:
60
        link(const link&);
61
        void operator=(const link&);
62
    };
63
    unsigned count;
64
    link *list_head;
65
    link *list_tail;
66
    virtual link *copy_item(link *old_item) const = 0;
67
    void prepend(link *item);
68
    void append(link *item);
69
    void prepend(const ListDProto& proto);
70
    void append(const ListDProto& proto);
71
    void remove(link *item);
72
    link *ref(const Vix&) const;
73
};
74
template
75
class ListD: public ListDProto {
76
public:
77
    void prepend(const T& item);
78
    void append(const T& item);
79
    const T& head() const;
80
    T& head();
81
    void head(T& fill) const;
82
    void remove_head()
83
        { ListDProto::remove_head(); }
84
    void remove_head(T& fill);
85
    const T& tail() const;
86
    T& tail();
87
    void tail(T& fill) const;
88
    void remove_tail()
89
        { ListDProto::remove_tail(); }
90
    void remove_tail(T& fill);
91
    class Vix: public ListDProto::Vix {
92
    public:
93
        Vix(): ListDProto::Vix()
94
            { }
95
    protected:
96
        friend class ListD;
97
        Vix(const ListDProto::Vix& x): ListDProto::Vix(x)
98
            { }
99
    };
100
    Vix first() const
101
        { return ListDProto::first(); };
102
    void first(Vix& x) const
103
        { ListDProto::first(x); };
104
    void next(Vix& x, ListDProto::Action a = NORMAL) const
105
        { ListDProto::next(x, a); }// { dg-error "" } .*// ERROR - .*
106
    Vix last() const
107
        { return ListDProto::last(); }
108
    void last(Vix& x) const
109
        { return ListDProto::last(x); }
110
    void prev(Vix& x, ListDProto::Action a = NORMAL) const
111
        { return ListDProto::prev(x, a); }
112
protected:
113
    struct link_item: public ListDProto::link {
114
        T item;
115
        link_item(const T& i): link(0, 0), item(i)
116
            { }
117
    private:
118
        link_item(const link_item&);
119
        void operator=(const link_item&);
120
    };
121
public:
122
    T& operator()(const Vix& x)
123
        { link_item *li = (link_item *) ref(x);
124
          return li->item; }
125
    const T& operator()(const Vix& x) const
126
        { link_item *li = (link_item *) ref(x);
127
          return li->item; }
128
private:
129
    ListDProto::link *copy_item(ListDProto::link *old_item) const;
130
};
131
template
132
class SetLD: private ListD {
133
public:
134
    SetLD();
135
    SetLD(const ListD&);
136
    void add(const T& item);
137
    void add(const ListD& other);
138
    void add(const SetLD& other);
139
    void remove(const T& item);
140
    bool contains(const T& item) const;
141
    ListD::length;
142
    ListD::empty;
143
    ListD::clear;
144
    typedef typename ListD::Vix Vix;
145
    ListD::first;
146
    ListD::next;
147
    ListD::operator();
148
 
149
  using ListD::NORMAL;
150
  using ListD::REMOVE_CURRENT;
151
};
152
extern "C" {
153
extern void __eprintf (const char *, const char *, unsigned, const char *);
154
}
155
extern "C" {
156
extern void __eprintf (const char *, const char *, unsigned, const char *);
157
}
158
template
159
void
160
ListD::prepend(const T& item)
161
{
162
    link *newl = new link_item(item);
163
    ListDProto::prepend(newl);
164
}
165
template
166
void
167
ListD::append(const T& item)
168
{
169
    link *newl = new link_item(item);
170
    ListDProto::append(newl);
171
}
172
template
173
const T&
174
ListD::head() const
175
{
176
    ((void) (( 0 != list_head ) ? 0 : (__eprintf ("%s:%u: failed assertion `%s'\n",       "/home/wbaker/work/include/templates/ListD.body.h" ,   50 ,  "0 != list_head" ), 0) )) ;
177
    link_item *h = (link_item *) list_head;
178
    return h->item;
179
}
180
template
181
T&
182
ListD::head()
183
{
184
    ((void) (( 0 != list_head ) ? 0 : (__eprintf ("%s:%u: failed assertion `%s'\n",       "/home/wbaker/work/include/templates/ListD.body.h" ,   59 ,  "0 != list_head" ), 0) )) ;
185
    link_item *h = (link_item *) list_head;
186
    return h->item;
187
}
188
template
189
void
190
ListD::head(T& fill) const
191
{
192
    ((void) (( 0 != list_head ) ? 0 : (__eprintf ("%s:%u: failed assertion `%s'\n",       "/home/wbaker/work/include/templates/ListD.body.h" ,   68 ,  "0 != list_head" ), 0) )) ;
193
    link_item *h = (link_item *) list_head;
194
    fill = h->item;
195
}
196
template
197
void
198
ListD::remove_head(T& fill)
199
{
200
    head(fill);
201
    remove_head();
202
}
203
template
204
const T&
205
ListD::tail() const
206
{
207
    ((void) (( 0 != list_tail ) ? 0 : (__eprintf ("%s:%u: failed assertion `%s'\n",       "/home/wbaker/work/include/templates/ListD.body.h" ,   85 ,  "0 != list_tail" ), 0) )) ;
208
    link_item *h = (link_item *) list_tail;
209
    return h->item;
210
}
211
template
212
T&
213
ListD::tail()
214
{
215
    ((void) (( 0 != list_tail ) ? 0 : (__eprintf ("%s:%u: failed assertion `%s'\n",       "/home/wbaker/work/include/templates/ListD.body.h" ,   94 ,  "0 != list_tail" ), 0) )) ;
216
    link_item *h = (link_item *) list_tail;
217
    return h->item;
218
}
219
template
220
void
221
ListD::tail(T& fill) const
222
{
223
    ((void) (( 0 != list_tail ) ? 0 : (__eprintf ("%s:%u: failed assertion `%s'\n",       "/home/wbaker/work/include/templates/ListD.body.h" ,   103 ,  "0 != list_tail" ), 0) )) ;
224
    link_item *h = (link_item *) list_tail;
225
    fill = h->item;
226
}
227
template
228
void
229
ListD::remove_tail(T& fill)
230
{
231
    ((void) (( 0 != list_tail ) ? 0 : (__eprintf ("%s:%u: failed assertion `%s'\n",       "/home/wbaker/work/include/templates/ListD.body.h" ,   112 ,  "0 != list_tail" ), 0) )) ;
232
    link_item *h = (link_item *) list_tail;
233
    fill = h->item;
234
}
235
template
236
ListDProto::link *
237
ListD::copy_item(ListDProto::link *old) const
238
{
239
    link_item *old_item = (link_item *) old;
240
    link_item *new_item = new link_item(old_item->item);
241
    return new_item;
242
}
243
template
244
SetLD::SetLD():
245
ListD()
246
{ }
247
template
248
SetLD::SetLD(const ListD& other):
249
ListD(other)
250
{ }
251
template
252
void
253
SetLD::add(const T& item)
254
{
255
    if ( ! contains(item) )
256
      this->append(item);
257
}
258
template
259
void
260
SetLD::add(const ListD& other)
261
{
262
    typename ListD::Vix x;
263
    for (first(x); 0 != x; next(x))
264
        add(other(x));
265
}
266
template
267
void
268
SetLD::add(const SetLD& other)
269
{
270
    const ListD& lother = other;
271
    add(lother);
272
}
273
template
274
void
275
SetLD::remove(const T& item)
276
{
277
    typename ListD::Action a = this->NORMAL;
278
    Vix x;
279
    for (first(x); 0 != x && this->REMOVE_CURRENT != a; next(x, a))
280
        a = operator()(x) == item ? this->REMOVE_CURRENT: this->NORMAL; // { dg-error "" } .*
281
    // { dg-message "(candidate|not derived from)" "candidate note" { target *-*-* } 280 }
282
}
283
template
284
bool
285
SetLD::contains(const T& item) const
286
{
287
    Vix x;
288
    for (first(x); 0 != x; next(x)) {
289
        if (operator()(x) == item)// { dg-error "" } .*
290
          // { dg-message "(candidate|not derived from)" "candidate note" { target *-*-* } 289 }
291
            return TRUE;
292
    }
293
    return FALSE;
294
}
295
template
296
int
297
operator==(const SetLD& a, const SetLD& b) // { dg-message "note" }
298
{
299
    if (a.length() != b.length())
300
        return FALSE;
301
    typename SetLD::Vix x;
302
    for (a.first(x); 0 != x; a.next(x)) {
303
        if ( ! b.contains(a(x)) )
304
            return FALSE;
305
    }
306
    for (b.first(x); 0 != x; b.next(x)) {
307
        if ( ! a.contains(b(x)) )
308
            return FALSE;
309
    }
310
    return TRUE;
311
}
312
template
313
int
314
operator!=(const SetLD& a, const SetLD& b)
315
{ return ! (a == b); }
316
template
317
int
318
operator<=(const SetLD& a, const SetLD& b)
319
{
320
    if (a.length() > b.length())
321
        return FALSE;
322
    typename SetLD::Vix x;
323
    for (x=a.first(); 0 != x; a.next(x)) {
324
        if ( ! b.contains(a(x)) )
325
            return FALSE;
326
    }
327
    return TRUE;
328
}
329
template
330
int
331
operator<(const SetLD& a, const SetLD& b)
332
{
333
    if (a.length() >= b.length())
334
        return FALSE;
335
    return a <= b;
336
}
337
template
338
int
339
operator>(const SetLD& a, const SetLD& b)
340
{ return ! (a <= b); }
341
template
342
int
343
operator>=(const SetLD& a, const SetLD& b)
344
{ return ! (a < b); }
345
class String { };
346
class IcaseString: public String { };
347
template <> class SetLD< IcaseString >: public SetLD<    String  > {       public:  SetLD (): SetLD<    String  >() { };  SetLD (const ::ListD<   IcaseString  >& other): SetLD<    String  >()	{ ::ListD<   IcaseString  >::Vix x;  for (other.first(x); 0 != x; other.next(x))     add(other(x)); };        SetLD (const  SetLD & other): SetLD<    String  >(other) { };  const    IcaseString  & operator()(const Vix& x) const	{ return (   IcaseString  &) SetLD<    String  >::operator()(x); }       };      typedef SetLD<  String > SetLD_String_IcaseString_old_tmp99;       typedef SetLD< IcaseString > SetLD_String_IcaseString_new_tmp99;
348
inline int       operator== (const SetLD_String_IcaseString_new_tmp99& a,       const SetLD_String_IcaseString_new_tmp99& b) // { dg-message "operator==|no known conversion" }
349
{
350
const SetLD_String_IcaseString_old_tmp99& oa = a;
351
const SetLD_String_IcaseString_old_tmp99& ob = b;
352
return  operator== (oa, ob);    }
353
inline int       operator!= (const SetLD_String_IcaseString_new_tmp99& a,       const SetLD_String_IcaseString_new_tmp99& b)
354
{
355
const SetLD_String_IcaseString_old_tmp99& oa = a;
356
const SetLD_String_IcaseString_old_tmp99& ob = b;
357
return  operator!= (oa, ob);    }
358
inline int       operator< (const SetLD_String_IcaseString_new_tmp99& a,        const SetLD_String_IcaseString_new_tmp99& b)
359
{
360
const SetLD_String_IcaseString_old_tmp99& oa = a;
361
const SetLD_String_IcaseString_old_tmp99& ob = b;
362
return  operator< (oa, ob);     }
363
inline int       operator<= (const SetLD_String_IcaseString_new_tmp99& a,       const SetLD_String_IcaseString_new_tmp99& b)
364
{
365
const SetLD_String_IcaseString_old_tmp99& oa = a;
366
const SetLD_String_IcaseString_old_tmp99& ob = b;
367
return  operator<= (oa, ob);    }
368
inline int       operator> (const SetLD_String_IcaseString_new_tmp99& a,        const SetLD_String_IcaseString_new_tmp99& b)
369
{
370
const SetLD_String_IcaseString_old_tmp99& oa = a;
371
const SetLD_String_IcaseString_old_tmp99& ob = b;
372
return  operator> (oa, ob);     }
373
inline int       operator>= (const SetLD_String_IcaseString_new_tmp99& a,       const SetLD_String_IcaseString_new_tmp99& b)
374
{
375
const SetLD_String_IcaseString_old_tmp99& oa = a;
376
const SetLD_String_IcaseString_old_tmp99& ob = b;
377
return  operator>= (oa, ob);    }
378
typedef SetLD SLDiS;
379
static void
380
nop(int i)
381
{
382
    SetLD x, y;
383
    nop(x == y);
384
 nop(x != y);
385
nop(x < y);
386
nop(x <= y);
387
nop(x > y);
388
nop(x >= y);
389
}
390
 
391
template class SetLD;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.