Debian Codegraph @

gcc/testsuite/g++.dg/other/pr24623.C

raw
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 static RefCountPointer a;
38 return a;
39 }
40 ~RefCountPointer ()
41 {
42 }
43 T *_p;
44 };
45 class Item:public ReferenceCounted
46 {
47 public:
48
49 typedef RefCountPointer < const Item > Ptr;
50 };
51 class AnyAtomicType:public Item
52 {
53 };
54 class StaticContext
55 {
56 };
57 class DynamicContext:public StaticContext
58 {
59 };
60 class SortableItem
61 {
62 SortableItem ();
63 int m_bAscending:1;
64 DynamicContext *m_context;
65 AnyAtomicType::Ptr m_item;
66 };
67 SortableItem::SortableItem ()
68 {
69 m_context = __null;
70 m_item = __null;
71 }