Boost logo

Boost Users :

Subject: Re: [Boost-users] [Boost.Test] valgrind complains about invalid reads
From: Gennadiy Rozental (rogeeff_at_[hidden])
Date: 2009-12-17 00:32:48

Scott Banachowski <sbanacho <at>> writes:

> I agree with Peter here, the destructor for test_unit should be virtual.

'Should' is a strong statement. Do you have anything to based it on?

> I find that it is being deleted when
> test_unit* is a stored in reference counted pointer,


> and at program exit it is being deleted by calling ~test_unit().

Where do I call destructor explicitly?

> If you use a derived class (test_suite), this is leading to an error.


> Also, in the code I'm looking at (1.40.0), the test_suite class has a
> virtual destructor, but its base class test_unit does not.
> Not making the base class virtual seems to be defeating the purpose.

What purpose? The only reason that test_suite destructor is virtual is because
this class in fact is being polymorphically. It has subclass master_test_suite.


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at