Boost C++ Libraries: Ticket #6873: g++-4.7.0 warns about non-virtual destructor when -Wall https://svn.boost.org/trac10/ticket/6873 <pre class="wiki"> // 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&lt;boost::tag_original_exception_type, const std::type_info*&gt;]': // ../boost/boost/smart_ptr/detail/shared_count.hpp:95:13: required from // 'boost::detail::shared_count::shared_count(Y*) [with Y = // boost::error_info&lt;boost::tag_original_exception_type, const std::type_info*&gt;]' // ../boost/boost/smart_ptr/shared_ptr.hpp:183:50: required from // 'boost::shared_ptr&lt;T&gt;::shared_ptr(Y*) [with Y = // boost::error_info&lt;boost::tag_original_exception_type, const std::type_info*&gt;; T = // boost::error_info&lt;boost::tag_original_exception_type, const std::type_info*&gt;]' // ../boost/boost/exception/info.hpp:171:69: required from 'const E&amp; // boost::exception_detail::set_info(const E&amp;, const boost::error_info&lt;Tag, T&gt;&amp;) [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&lt;boost::exception_detail::derives_boost_exception&lt;E&gt;, const E&amp;&gt;::type // boost::operator&lt;&lt;(const E&amp;, const boost::error_info&lt;Tag, T&gt;&amp;) [with E = boost::unknown_exception; // Tag = boost::tag_original_exception_type; T = const std::type_info*; typename // boost::enable_if&lt;boost::exception_detail::derives_boost_exception&lt;E&gt;, const E&amp;&gt;::type = const // boost::unknown_exception&amp;]' // ../boost/boost/exception/detail/exception_ptr.hpp:182:13: required from 'void // boost::unknown_exception::add_original_type(const E&amp;) [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&lt;boost::tag_original_exception_type, const std::type_info*&gt;' which has non-virtual // destructor might cause undefined behaviour [-Wdelete-non-virtual-dtor] </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/6873 Trac 1.4.3 david x callaway <dxc@…> Wed, 09 May 2012 09:16:33 GMT <link>https://svn.boost.org/trac10/ticket/6873#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6873#comment:1</guid> <description> <p> this has the same root cause as <a class="reopened ticket" href="https://svn.boost.org/trac10/ticket/6824" title="#6824: Bugs: warning: delete called on boost::error_info... that has virtual ... (reopened)">#6824</a> but a different compiler. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Thu, 05 Jul 2012 13:25:46 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/6873#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6873#comment:2</guid> <description> <p> this issue is fixed in 1.50. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Wed, 15 Aug 2012 20:04:46 GMT</pubDate> <title>component changed https://svn.boost.org/trac10/ticket/6873#comment:3 https://svn.boost.org/trac10/ticket/6873#comment:3 <ul> <li><strong>component</strong> <span class="trac-field-old">threads</span> → <span class="trac-field-new">thread</span> </li> </ul> Ticket viboes Wed, 15 Aug 2012 21:24:33 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/6873#comment:4 https://svn.boost.org/trac10/ticket/6873#comment:4 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">duplicate</span> </li> </ul> <p> Duplicate <a class="reopened ticket" href="https://svn.boost.org/trac10/ticket/6824" title="#6824: Bugs: warning: delete called on boost::error_info... that has virtual ... (reopened)">#6824</a>. </p> Ticket