OSDN Git Service

* gcc.dg/20041106-1.c, gcc.dg/20030321-1.c, gcc.dg/pr17112-1.c,
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / other / pr24623.C
1 /* This used to ICE due to a backend problem on s390.  */
2
3 /* { dg-do compile } */
4 /* { dg-options "-O1" } */
5
6 class ReferenceCounted
7 {
8 public:
9
10   virtual ~ ReferenceCounted ()
11   {
12   }
13   void decrementRefCount () const
14   {
15     if (--const_cast < unsigned int &>(_ref_count) == 0)
16       {
17         delete this;
18       }
19   }
20   unsigned int _ref_count;
21 };
22
23 template < class T > class RefCountPointer
24 {
25 public:
26
27 RefCountPointer (T * p = 0):_p (p)
28   {
29   }
30   RefCountPointer & operator= (const RefCountPointer < T > &o)
31   {
32     if (_p != o._p)
33       {
34         if (_p != 0)
35           _p->decrementRefCount ();
36       }
37   }
38   ~RefCountPointer ()
39   {
40   }
41   T *_p;
42 };
43 class Item:public ReferenceCounted
44 {
45 public:
46
47   typedef RefCountPointer < const Item > Ptr;
48 };
49 class AnyAtomicType:public Item
50 {
51 };
52 class StaticContext
53 {
54 };
55 class DynamicContext:public StaticContext
56 {
57 };
58 class SortableItem
59 {
60   SortableItem ();
61   int m_bAscending:1;
62   DynamicContext *m_context;
63     AnyAtomicType::Ptr m_item;
64 };
65 SortableItem::SortableItem ()
66 {
67   m_context = __null;
68   m_item = __null;
69 }