1 // { dg-do compile } 2 // { dg-options "-ftree-vrp -fno-guess-branch-probability -fnon-call-exceptions" } 3 // { dg-additional-options "-Wno-return-type" } 4 5 void *xalloc (); 6 void xfree (void *); 7 void error (); 8 9 static inline void * MallocT()10MallocT () 11 { 12 void *p = xalloc (); 13 if (!p) 14 error (); 15 return p; 16 } 17 18 19 struct ByteBlob 20 { 21 int *header; 22 23 ByteBlob(); 24 ~ByteBlobByteBlob25 ~ByteBlob () 26 { 27 Free (); 28 } 29 RawFreeByteBlob30 int RawFree (int * p) 31 { 32 if (!p) 33 error (); 34 xfree (p); 35 } 36 37 int *LengthRef (); 38 FreeByteBlob39 void Free () 40 { 41 if (*header) 42 RawFree (header); 43 } 44 AppendByteBlob45 int Append (int num_ints) 46 { 47 if (*header) 48 MallocT (); 49 *LengthRef () += num_ints; 50 } 51 }; 52 53 struct CBlobT:ByteBlob 54 { ~CBlobTCBlobT55 ~CBlobT () 56 { 57 Free (); 58 } 59 }; 60 61 template < class T > struct FixedSizeArray 62 { 63 int HeaderSize; 64 T *data; 65 FixedSizeArray (); RefCntFixedSizeArray66 int RefCnt () 67 { 68 return *(int *) MallocT (); 69 } ~FixedSizeArrayFixedSizeArray70 ~FixedSizeArray () 71 { 72 if (RefCnt ()) 73 for (T * pItem = data + Length (); pItem != data; pItem--) 74 T (); 75 } 76 int Length (); 77 }; 78 79 class SmallArray 80 { 81 typedef FixedSizeArray < int > SubArray; 82 typedef FixedSizeArray < SubArray > SuperArray; 83 SuperArray data; 84 }; 85 86 struct CHashTableT 87 { 88 int *m_slots; ~CHashTableTCHashTableT89 ~CHashTableT () 90 { 91 delete m_slots; 92 } 93 }; 94 95 struct CYapfBaseT 96 { 97 int *PfGetSettings (); 98 SmallArray m_arr; 99 CHashTableT m_closed; CYapfBaseTCYapfBaseT100 CYapfBaseT () 101 { 102 MallocT (); 103 } 104 }; 105 106 struct CYapfCostRailT:CYapfBaseT 107 { 108 CBlobT m_sig_look_ahead_costs; CYapfCostRailTCYapfCostRailT109 CYapfCostRailT () 110 { 111 m_sig_look_ahead_costs.Append (*Yapf ()->PfGetSettings ()); 112 Yapf ()->PfGetSettings (); 113 } 114 CYapfBaseT *Yapf (); 115 }; 116 stCheckReverseTrain()117void stCheckReverseTrain () 118 { 119 CYapfCostRailT pf1; 120 } 121