| 115 | |
| 116 | |
| 117 | class D: public gc {public: |
| 118 | /* A collectable class with a static member function to be used as |
| 119 | an explicit clean-up function supplied to ::new. */ |
| 120 | |
| 121 | D( int iArg ): i( iArg ) { |
| 122 | nAllocated++;} |
| 123 | static void CleanUp( void* obj, void* data ) { |
| 124 | D* self = (D*) obj; |
| 125 | nFreed++; |
| 126 | my_assert( self->i == (int) (GC_word) data );} |
| 127 | static void Test() { |
| 128 | my_assert( nFreed >= .8 * nAllocated );} |
| 129 | |
| 130 | int i; |
| 131 | static int nFreed; |
| 132 | static int nAllocated;}; |
| 133 | |
| 134 | int D::nFreed = 0; |
| 135 | int D::nAllocated = 0; |
nothing calls this directly
no outgoing calls
no test coverage detected