Subject: [Boost-bugs] [Boost C++ Libraries] #6873: g++-4.7.0 warns about non-virtual destructor when -Wall
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-05-06 19:08:36
#6873: g++-4.7.0 warns about non-virtual destructor when -Wall
----------------------------------------------+-----------------------------
Reporter: david x callaway <dxc@â¦> | Owner: anthonyw
Type: Bugs | Status: new
Milestone: To Be Determined | Component: threads
Version: Boost 1.49.0 | Severity: Problem
Keywords: |
----------------------------------------------+-----------------------------
{{{
// output lines are pre-broken because I didn't know what your
// formatter would do to it.
//
// sure, I could turn the warning off, but I don't want to turn it off for
// production code and I don't want to use a bunch of pragmas and
// conditional garbage to make gcc and msvc happy.
//
// thx
// dxc
//
// compile the test code like this (use your own appropriate paths):
// /opt/gcc-4.7.0/bin/g++ -m64 -Wall -I ../boost t.cpp
// ~/boost/boost/osx/lib/libboost_thread-xgcc42-mt-s-1_49.a
// fails, see errors included below, after the test code.
// boost-1.49.0, test code compiled on os/x 10.7.3
// we normally compile -Werror -Wall -Wextra, so to us this failure is
// a serious problem.
// gcc-4.6.3 built the same way (using the same build script to build
// gcc) compiles this with no warnings.
// if no -Wall gcc-4.7.0 also compiles it with no warnings.
// gcc-4.7.0 output with -Wall is shown after the test code
// --- cut ---
#include "boost/thread.hpp"
int main(int /* argc */, const char** /* argv */)
{
return 0;
}
// --- cut ---
//-----------------------------------------------------
// gcc -v output:
// Using built-in specs.
// COLLECT_GCC=/opt/gcc-4.7.0/bin/gcc
// COLLECT_LTO_WRAPPER=/opt/gcc-4.7.0/libexec/gcc/x86_64-apple-
darwin11.3.0/4.7.0/lto-wrapper
// Target: x86_64-apple-darwin11.3.0
// Configured with: ../gcc-4.7.0/configure --prefix=/opt/gcc-4.7.0
// --enable-languages=c,c++
// --disable-nls --enable-__cxa_atexit --enable-shared --enable-
threads
// --with-gmp=/opt/gcc-4.7.0 --with-mpc=/opt/gcc-4.7.0 --with-
mpfr=/opt/gcc-4.7.0
// Thread model: posix
// gcc version 4.7.0 (GCC)
//-----------------------------------------------------
// compiler output from g++-4.7.0:
// In file included from ../boost/boost/smart_ptr/shared_ptr.hpp:30:0,
// from ../boost/boost/shared_ptr.hpp:17,
// from ../boost/boost/thread/pthread/thread_data.hpp:10,
// from ../boost/boost/thread/thread.hpp:17,
// from ../boost/boost/thread.hpp:13,
// from t.cpp:24:
// ../boost/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*>]':
// ../boost/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*>]'
// ../boost/boost/smart_ptr/shared_ptr.hpp:183: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*>]'
// ../boost/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*]'
// ../boost/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&]'
// ../boost/boost/exception/detail/exception_ptr.hpp:182:13: required
from 'void
// boost::unknown_exception::add_original_type(const E&) [with E =
std::exception]'
// ../boost/boost/exception/detail/exception_ptr.hpp:161:32: required
from here
// ../boost/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]
}}}
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/6873> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:09 UTC