The attached code does various things with a type ("inv") that increments a count on constructor calls and decrements on destructor calls. As there are no declarations of this type, only temporaries, the net should be zero at the end of each statement. Unfortunately, the count goes negative. Ivan
Created attachment 10780 [details] source code
You are missing copy constructor invocations. Add inv(const inv&) { ++count; }