2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.brendan / recurse.C
blobde20a0732219334744d49af60b16acfbaa0da3da
1 // { dg-do assemble  }
2 // GROUPS passed recursive-aborts
3 // types
4 typedef unsigned int DBflag;   // for storing user flag value
5 typedef unsigned long DBoffset; // 32-bit unsigned integer
6 typedef DBoffset DBsize;  // type for storing sizes of objects
7 typedef unsigned char DBbyte;   // 8-bit unsigned char
9 class DBlink
11 protected:
12   DBbyte link[4];       // hold link in portable MSB first format
13 public:
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; }
24 typedef DBlink DBsizerec;       // hold data record size in portable format
26 // constants
27 const DBoffset DB_NULL = 0;
29 class DBlinkrec
31 protected:
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
36 public:
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(); }
57   friend class DataBase;
60 class DBpathrec : public DBlinkrec
62   DBoffset offset;    // offset of link record in LNK file
63 public:
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; }
71   friend class DataBase;
74 int main()
76   DBpathrec a(), b();
78   a = b;// { dg-error "" }  non-lvalue in assignment.*