1// { dg-do assemble  }
2// GROUPS passed recursive-aborts
3// types
4typedef unsigned int DBflag;   // for storing user flag value
5typedef unsigned long DBoffset; // 32-bit unsigned integer
6typedef DBoffset DBsize;  // type for storing sizes of objects
7typedef unsigned char DBbyte;   // 8-bit unsigned char
8
9class DBlink
10{
11protected:
12  DBbyte link[4];       // hold link in portable MSB first format
13public:
14  DBlink(DBoffset = 0, DBflag = 0);
15  DBlink &operator=(const DBlink &);
16  DBlink &operator=(DBoffset);
17  operator DBoffset();
18  operator const DBbyte *() { return link; }
19  void set_flag() { link[0] |= 0x80; }
20  void reset_flag() { link[0] &= 0x7f; }
21  int test_flag() const { return (link[0] & 0x80) != 0; }
22};
23
24typedef DBlink DBsizerec;       // hold data record size in portable format
25
26// constants
27const DBoffset DB_NULL = 0;
28
29class DBlinkrec
30{
31protected:
32  // offsets are stored with MSB in link[0]
33  DBlink l;  // offset into link file of right child - MSB = red bit
34  DBlink r;  // offset into link file of left child - MSB = delete
35  DBlink d;  // offset into parallel data file - MSB = user flag
36public:
37  DBlinkrec():l(DB_NULL), r(DB_NULL), d(DB_NULL) {}
38  void make_red() // set link to red
39  { l.set_flag(); }
40  void make_black() // set link to black
41  { l.reset_flag(); }
42  int is_red() const // indicates whether this is a red link
43  { return l.test_flag(); }
44  void set_discard() // set discard flag
45  { r.set_flag(); }
46  void reset_discard() // reset discard flag
47  { r.reset_flag(); }
48  int is_discarded() const // check discard flag
49  { return r.test_flag(); }
50  void set_flag() // set user flag
51  { d.set_flag(); }
52  void reset_flag() // reset user flag
53  { d.reset_flag(); }
54  int is_flag() const // check user flag
55  { return d.test_flag(); }
56
57  friend class DataBase;
58};
59
60class DBpathrec : public DBlinkrec
61{
62  DBoffset offset;    // offset of link record in LNK file
63public:
64  DBpathrec():offset(DB_NULL) { }
65  DBpathrec(DBoffset off, const DBlinkrec &lr):offset(off), DBlinkrec(lr) {}
66  operator DBoffset() { return offset; }
67  DBpathrec &operator=(DBoffset off) { offset = off; return *this; }
68  DBpathrec &operator=(const DBpathrec &pr)
69  { offset = pr.offset; (DBlinkrec)*this = (DBlinkrec)pr; return *this; }
70
71  friend class DataBase;
72};
73
74int main()
75{
76  DBpathrec a(), b();
77
78  a = b;// { dg-error "" }  non-lvalue in assignment.*
79}
80
81