blob: de20a0732219334744d49af60b16acfbaa0da3da (
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
|
// { dg-do assemble }
// GROUPS passed recursive-aborts
// types
typedef unsigned int DBflag; // for storing user flag value
typedef unsigned long DBoffset; // 32-bit unsigned integer
typedef DBoffset DBsize; // type for storing sizes of objects
typedef unsigned char DBbyte; // 8-bit unsigned char
class DBlink
{
protected:
DBbyte link[4]; // hold link in portable MSB first format
public:
DBlink(DBoffset = 0, DBflag = 0);
DBlink &operator=(const DBlink &);
DBlink &operator=(DBoffset);
operator DBoffset();
operator const DBbyte *() { return link; }
void set_flag() { link[0] |= 0x80; }
void reset_flag() { link[0] &= 0x7f; }
int test_flag() const { return (link[0] & 0x80) != 0; }
};
typedef DBlink DBsizerec; // hold data record size in portable format
// constants
const DBoffset DB_NULL = 0;
class DBlinkrec
{
protected:
// offsets are stored with MSB in link[0]
DBlink l; // offset into link file of right child - MSB = red bit
DBlink r; // offset into link file of left child - MSB = delete
DBlink d; // offset into parallel data file - MSB = user flag
public:
DBlinkrec():l(DB_NULL), r(DB_NULL), d(DB_NULL) {}
void make_red() // set link to red
{ l.set_flag(); }
void make_black() // set link to black
{ l.reset_flag(); }
int is_red() const // indicates whether this is a red link
{ return l.test_flag(); }
void set_discard() // set discard flag
{ r.set_flag(); }
void reset_discard() // reset discard flag
{ r.reset_flag(); }
int is_discarded() const // check discard flag
{ return r.test_flag(); }
void set_flag() // set user flag
{ d.set_flag(); }
void reset_flag() // reset user flag
{ d.reset_flag(); }
int is_flag() const // check user flag
{ return d.test_flag(); }
friend class DataBase;
};
class DBpathrec : public DBlinkrec
{
DBoffset offset; // offset of link record in LNK file
public:
DBpathrec():offset(DB_NULL) { }
DBpathrec(DBoffset off, const DBlinkrec &lr):offset(off), DBlinkrec(lr) {}
operator DBoffset() { return offset; }
DBpathrec &operator=(DBoffset off) { offset = off; return *this; }
DBpathrec &operator=(const DBpathrec &pr)
{ offset = pr.offset; (DBlinkrec)*this = (DBlinkrec)pr; return *this; }
friend class DataBase;
};
int main()
{
DBpathrec a(), b();
a = b;// { dg-error "" } non-lvalue in assignment.*
}
|