Boost Users :
Subject: Re: [Boost-users] [Boost.Test] valgrind complains about invalid reads
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2009-12-18 00:00:58
joel falcou wrote:
> Scott Banachowski wrote:
>> By defeating the purpose, I mean it forces code like the following:
>> if( ut_detail::test_id_2_unit_type( tu.second->p_id ) == tut_suite )
>> delete static_cast<test_suite const*>(tu.second);
>> delete static_cast<test_case const*>(tu.second);
>> A virtual base case simplifies this code (especially if in the future
>> other classes are added, or in the case of replacement allocator it
>> does the right thing).
> I'm jumping in the wagon but this very piece of code leads to a
> "incorrect free" on Snow Leopard using g++ 4.2.1 Apple.
> Maybe it is related to the virtual matter
We've already discussed this many times. The code above
is wrong for reasons unrelated to the use of a virtual destructor,
although adding a virtual destructor masks the problem.
This has been fixed in the trunk.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net