chriskohlhoff / asio

Asio C++ Library
http://think-async.com/Asio
4.86k stars 1.21k forks source link

Compilation with Werror broken for clang #137

Open PSIAlt opened 7 years ago

PSIAlt commented 7 years ago

Im using BOOST_VERSION 105800

Took echo server example from here http://www.boost.org/doc/libs/1_54_0/doc/html/boost_asio/example/cpp03/spawn/echo_server.cpp

And compiling with clang (Apple LLVM version 8.0.0 (clang-800.0.38)): g++ echo_example.cpp -o echo_example -I/usr/local/include -std=c++11 -Wall -Werror -ggdb3 -O2 -Wno-unused-local-typedef -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -Wno-deprecated-declarations

It gives warnings below and -Werror makes it not compile. With option -Wno-delete-non-virtual-dtor it does build normally. This may or may not be a bug

In file included from echo_example.cpp:14:
In file included from /usr/local/include/boost/asio/spawn.hpp:19:
In file included from /usr/local/include/boost/coroutine/all.hpp:11:
In file included from /usr/local/include/boost/coroutine/coroutine.hpp:10:
In file included from /usr/local/include/boost/coroutine/asymmetric_coroutine.hpp:31:
/usr/local/include/boost/coroutine/detail/push_coroutine_object.hpp:256:9: error: destructor called on non-final 'boost::coroutines::detail::push_coroutine_object<boost::coroutines::pull_coroutine<void>, void,
      boost::asio::detail::coro_entry_point<boost::asio::detail::wrapped_handler<boost::asio::io_service::strand, void (*)(), boost::asio::detail::is_continuation_if_running>, boost::_bi::bind_t<void, boost::_mfi::mf1<void, session,
      boost::asio::basic_yield_context<boost::asio::detail::wrapped_handler<boost::asio::io_service::strand, void (*)(), boost::asio::detail::is_continuation_if_running> > >, boost::_bi::list2<boost::_bi::value<boost::shared_ptr<session>
      >, boost::arg<1> > > > &, boost::coroutines::basic_standard_stack_allocator<boost::coroutines::stack_traits> >' that has virtual functions but non-virtual destructor [-Werror,-Wdelete-non-virtual-dtor]
        obj->~obj_t();
        ^
/usr/local/include/boost/coroutine/detail/push_coroutine_object.hpp:323:7: note: in instantiation of member function 'boost::coroutines::detail::push_coroutine_object<boost::coroutines::pull_coroutine<void>, void,
      boost::asio::detail::coro_entry_point<boost::asio::detail::wrapped_handler<boost::asio::io_service::strand, void (*)(), boost::asio::detail::is_continuation_if_running>, boost::_bi::bind_t<void, boost::_mfi::mf1<void, session,
      boost::asio::basic_yield_context<boost::asio::detail::wrapped_handler<boost::asio::io_service::strand, void (*)(), boost::asio::detail::is_continuation_if_running> > >, boost::_bi::list2<boost::_bi::value<boost::shared_ptr<session>
      >, boost::arg<1> > > > &, boost::coroutines::basic_standard_stack_allocator<boost::coroutines::stack_traits> >::deallocate_' requested here
    { deallocate_( this); }
      ^
/usr/local/include/boost/coroutine/detail/push_coroutine_object.hpp:277:5: note: in instantiation of member function 'boost::coroutines::detail::push_coroutine_object<boost::coroutines::pull_coroutine<void>, void,
      boost::asio::detail::coro_entry_point<boost::asio::detail::wrapped_handler<boost::asio::io_service::strand, void (*)(), boost::asio::detail::is_continuation_if_running>, boost::_bi::bind_t<void, boost::_mfi::mf1<void, session,
      boost::asio::basic_yield_context<boost::asio::detail::wrapped_handler<boost::asio::io_service::strand, void (*)(), boost::asio::detail::is_continuation_if_running> > >, boost::_bi::list2<boost::_bi::value<boost::shared_ptr<session>
      >, boost::arg<1> > > > &, boost::coroutines::basic_standard_stack_allocator<boost::coroutines::stack_traits> >::destroy' requested here
    push_coroutine_object( BOOST_RV_REF( Fn) fn, attributes const& attrs,
    ^
tm4n commented 7 years ago

I'm having the same issue, with clang version "Apple LLVM version 8.0.0 (clang-800.0.42.1)". Its probably an error with boost_coroutine and we should report it there.

vinniefalco commented 7 years ago

I am having this issue as well: http://www.boost.org/development/tests/develop/output/teeks99-02-dc3-9-14-Docker-64on64-beast-clang-linux-3-9~c++14-warnings.html#buffered_read_stream