1 |
149 |
jeremybenn |
// { dg-do assemble }
|
2 |
|
|
// GROUPS passed missed-error
|
3 |
|
|
// missed-error file
|
4 |
|
|
// From: Neil Wilson
|
5 |
|
|
// Date: Tue, 28 Apr 92 13:53:54 WET DST
|
6 |
|
|
// Subject: g++ version 2.1 bugs
|
7 |
|
|
// Message-ID: <15717.9204281253@cch.coventry.ac.uk>
|
8 |
|
|
|
9 |
|
|
|
10 |
|
|
// enum bool { FALSE = 0, TRUE = 1 };
|
11 |
|
|
|
12 |
|
|
typedef int T;
|
13 |
|
|
|
14 |
|
|
class Traversable {
|
15 |
|
|
public:
|
16 |
|
|
virtual const T item() const = 0;
|
17 |
|
|
virtual const bool off() const = 0;
|
18 |
|
|
virtual ~Traversable() { };
|
19 |
|
|
};
|
20 |
|
|
|
21 |
|
|
class Chain : public Traversable {
|
22 |
|
|
public:
|
23 |
|
|
virtual const int count() const = 0;
|
24 |
|
|
virtual const bool empty() const = 0;
|
25 |
|
|
virtual void forth() const = 0;
|
26 |
|
|
virtual const bool isfirst() const = 0;
|
27 |
|
|
virtual const bool islast() const = 0;
|
28 |
|
|
virtual const int position() const = 0;
|
29 |
|
|
virtual const T first() const = 0;
|
30 |
|
|
virtual const T last() const = 0;
|
31 |
|
|
virtual const T i_th(const int index) const = 0;
|
32 |
|
|
virtual void start() const = 0;
|
33 |
|
|
virtual void back() const = 0;
|
34 |
|
|
virtual void finish() const = 0;
|
35 |
|
|
virtual void move(const int index) const = 0;
|
36 |
|
|
virtual void go(const int index) const = 0;
|
37 |
|
|
virtual void put(const T value) = 0;
|
38 |
|
|
virtual void put_i_th(const T value, const int index) = 0;
|
39 |
|
|
virtual void swap(const int index) = 0;
|
40 |
|
|
virtual void wipe_out() = 0;
|
41 |
|
|
};
|
42 |
|
|
class List : public Chain {
|
43 |
|
|
protected:
|
44 |
|
|
int item_count;
|
45 |
|
|
int cursor_position;
|
46 |
|
|
virtual void go_offleft() const = 0;
|
47 |
|
|
virtual void go_offright() const = 0;
|
48 |
|
|
virtual void copy(const List& other) = 0;
|
49 |
|
|
public:
|
50 |
|
|
List() : item_count(0), cursor_position(0) { };
|
51 |
|
|
virtual const int count() const;
|
52 |
|
|
virtual const bool empty() const;
|
53 |
|
|
virtual const bool isfirst() const;
|
54 |
|
|
virtual const bool islast() const;
|
55 |
|
|
virtual const bool offleft() const;
|
56 |
|
|
virtual const bool offright() const;
|
57 |
|
|
virtual const bool off() const;
|
58 |
|
|
virtual const int position() const;
|
59 |
|
|
virtual const T first() const;
|
60 |
|
|
virtual const T last() const;
|
61 |
|
|
virtual const T i_th(const int index) const;
|
62 |
|
|
virtual void start() const;
|
63 |
|
|
virtual void forth() const;
|
64 |
|
|
virtual void back() const;
|
65 |
|
|
virtual void finish() const;
|
66 |
|
|
virtual void move(const int index) const;
|
67 |
|
|
virtual void go(const int index) const;
|
68 |
|
|
friend const bool operator==(const List& left,
|
69 |
|
|
const List& right);
|
70 |
|
|
friend const bool operator!=(const List& left,
|
71 |
|
|
const List& right);
|
72 |
|
|
virtual void put_i_th(const T value, const int index);
|
73 |
|
|
virtual void swap(const int index);
|
74 |
|
|
};
|
75 |
|
|
typedef int T;
|
76 |
|
|
class Array {
|
77 |
|
|
private:
|
78 |
|
|
int lower_index;
|
79 |
|
|
int upper_index;
|
80 |
|
|
T *array;
|
81 |
|
|
protected:
|
82 |
|
|
virtual void allocate(const int minindex, const int maxindex);
|
83 |
|
|
virtual void copy(const Array&other);
|
84 |
|
|
public:
|
85 |
|
|
Array(const int minindex, const int maxindex);
|
86 |
|
|
Array(const Array& other);
|
87 |
|
|
virtual const int count() const;
|
88 |
|
|
virtual const int lower() const;
|
89 |
|
|
virtual const int upper() const;
|
90 |
|
|
virtual const T item(const int index) const;
|
91 |
|
|
const T Array::operator[](const int index); // { dg-error "" } qualification ignored
|
92 |
|
|
virtual const bool valid_index(const int index) const;
|
93 |
|
|
virtual const bool empty() const;
|
94 |
|
|
friend const bool operator==(const Array& left, const Array& right);
|
95 |
|
|
friend const bool operator!=(const Array& left, const Array& right);
|
96 |
|
|
virtual void put(const T value, const int index);
|
97 |
|
|
virtual void wipe_out();
|
98 |
|
|
Array& operator=(const Array& other);
|
99 |
|
|
virtual ~Array();
|
100 |
|
|
};
|
101 |
|
|
class Fixed_List: public List, private Array {
|
102 |
|
|
protected:
|
103 |
|
|
virtual void go_offleft() const;
|
104 |
|
|
virtual void go_offright() const;
|
105 |
|
|
virtual void copy(const List& other);
|
106 |
|
|
public:
|
107 |
|
|
Fixed_List(const List& other);
|
108 |
|
|
Fixed_List(const int size): Array(1, size) { };
|
109 |
|
|
virtual const bool empty() const;
|
110 |
|
|
virtual const int count() const;
|
111 |
|
|
virtual const T item() const;
|
112 |
|
|
virtual const T i_th(const int index) const;
|
113 |
|
|
virtual void move(const int index) const;
|
114 |
|
|
virtual void put(const T value);
|
115 |
|
|
virtual void put_i_th(const T value, const int index);
|
116 |
|
|
virtual void wipe_out() { };
|
117 |
|
|
Fixed_List& operator=(const List& other);
|
118 |
|
|
};
|
119 |
|
|
|
120 |
|
|
void Fixed_List::go_offleft() const
|
121 |
|
|
{
|
122 |
|
|
cursor_position = 0;// { dg-error "" }
|
123 |
|
|
}
|
124 |
|
|
|