Boost logo

Boost :

Subject: Re: [boost] [exception] warning about non-virtual destructor - resolution?
From: Olaf van der Spek (ml_at_[hidden])
Date: 2012-04-18 07:54:31


On Wed, Apr 18, 2012 at 1:28 PM, Daniel James <dnljms_at_[hidden]> wrote:
> On 18 April 2012 12:16, Olaf van der Spek <ml_at_[hidden]> wrote:
>> On Wed, Apr 18, 2012 at 12:00 PM, Mathias Gaunard
>>
>> olaf_at_testing:~$ g++-4.7 -c -Wall demo.cpp
>
> Gcc suppresses warnings for headers installed to certain directories.
> Try running the test with a local boost checkout.

Ah, thanks!

$ g++-4.7 -c -Wall demo.cpp -Wdelete-non-virtual-dtor -I t/boost-trunk
In file included from demo.cpp:1:0:
t/boost-trunk/boost/checked_delete.hpp: In instantiation of ‘void
boost::checked_delete(T*) [with T =
boost::error_info<boost::tag_original_exception_type, const
std::type_info*>]’:
t/boost-trunk/boost/smart_ptr/detail/shared_count.hpp:95:13:
required from ‘boost::detail::shared_count::shared_count(Y*) [with Y =
boost::error_info<boost::tag_original_exception_type, const
std::type_info*>]’
t/boost-trunk/boost/smart_ptr/shared_ptr.hpp:177:50: required from
‘boost::shared_ptr<T>::shared_ptr(Y*) [with Y =
boost::error_info<boost::tag_original_exception_type, const
std::type_info*>; T =
boost::error_info<boost::tag_original_exception_type, const
std::type_info*>]’
t/boost-trunk/boost/exception/info.hpp:171:69: required from ‘const
E& boost::exception_detail::set_info(const E&, const
boost::error_info<Tag, T>&) [with E = boost::unknown_exception; Tag =
boost::tag_original_exception_type; T = const std::type_info*]’
t/boost-trunk/boost/exception/info.hpp:192:46: required from
‘typename boost::enable_if<boost::exception_detail::derives_boost_exception<E>,
const E&>::type boost::operator<<(const E&, const
boost::error_info<Tag, T>&) [with E = boost::unknown_exception; Tag =
boost::tag_original_exception_type; T = const std::type_info*;
typename boost::enable_if<boost::exception_detail::derives_boost_exception<E>,
const E&>::type = const boost::unknown_exception&]’
t/boost-trunk/boost/exception/detail/exception_ptr.hpp:182:13:
required from ‘void boost::unknown_exception::add_original_type(const
E&) [with E = std::exception]’
t/boost-trunk/boost/exception/detail/exception_ptr.hpp:161:32:
required from here
t/boost-trunk/boost/checked_delete.hpp:34:5: warning: deleting object
of polymorphic class type
‘boost::error_info<boost::tag_original_exception_type, const
std::type_info*>’ which has non-virtual destructor might cause
undefined behaviour [-Wdelete-non-virtual-dtor]

-- 
Olaf

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk