summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/other/pr24623.C
blob: 480bb39b63ae59292c350e09e7fc3b63df767dcf (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
/* This used to ICE due to a backend problem on s390.  */

/* { dg-do compile } */
/* { dg-options "-O1" } */

class ReferenceCounted
{
public:

  virtual ~ ReferenceCounted ()
  {
  }
  void decrementRefCount () const
  {
    if (--const_cast < unsigned int &>(_ref_count) == 0)
      {
	delete this;
      }
  }
  unsigned int _ref_count;
};

template < class T > class RefCountPointer
{
public:

RefCountPointer (T * p = 0):_p (p)
  {
  }
  RefCountPointer & operator= (const RefCountPointer < T > &o)
  {
    if (_p != o._p)
      {
	if (_p != 0)
	  _p->decrementRefCount ();
      }
  }
  ~RefCountPointer ()
  {
  }
  T *_p;
};
class Item:public ReferenceCounted
{
public:

  typedef RefCountPointer < const Item > Ptr;
};
class AnyAtomicType:public Item
{
};
class StaticContext
{
};
class DynamicContext:public StaticContext
{
};
class SortableItem
{
  SortableItem ();
  int m_bAscending:1;
  DynamicContext *m_context;
    AnyAtomicType::Ptr m_item;
};
SortableItem::SortableItem ()
{
  m_context = __null;
  m_item = __null;
}