简体   繁体   中英

boost::iostreams::bzip2_compressor fails only with c++0x

The bare-bones minimal example:

#include <boost/iostreams/filtering_stream.hpp>
#include <boost/iostreams/filter/bzip2.hpp>  
int main() {
  boost::iostreams::filtering_istream in;
  in.push(boost::iostreams::bzip2_compressor());
  return 0;
}

Compiles fine on my machine with:

g++ -lboost_iostreams  simple.cpp 

But fails when c++0x is included in either instance of :

g++ -lboost_iostreams  simple.cpp -std=c++0x
g++ -lboost_iostreams  simple.cpp -std=gnu++0x

The insanely long error message is below. What in the code is causing c++0x to fail? How can this be fixed? I've run this three machines, each with different configurations - it fails on two, but runs correctly on a stock Ubuntu install.

In file included from /usr/local/include/boost/iostreams/traits.hpp:31:0,
                 from /usr/local/include/boost/iostreams/pipeline.hpp:18,
                 from /usr/local/include/boost/iostreams/detail/push.hpp:22,
                 from /usr/local/include/boost/iostreams/filtering_stream.hpp:19,
                 from simple.cpp:1:
/usr/local/include/boost/iostreams/detail/wrap_unwrap.hpp: In instantiation of ‘T boost::iostreams::detail::wrap(const T&, typename boost::disable_if<boost::iostreams::is_std_io<T> >::type*) [with T = boost::iostreams::basic_bzip2_compressor<>; typename boost::disable_if<boost::iostreams::is_std_io<T> >::type = void]’:
/usr/local/include/boost/iostreams/stream_buffer.hpp:94:5:   required from ‘boost::iostreams::stream_buffer<T, Tr, Alloc, Mode>::stream_buffer(const T&, std::streamsize, std::streamsize) [with T = boost::iostreams::basic_bzip2_compressor<>; Tr = std::char_traits<char>; Alloc = std::allocator<char>; Mode = boost::iostreams::input; std::streamsize = long int]’
/usr/local/include/boost/iostreams/chain.hpp:257:60:   required from ‘void boost::iostreams::detail::chain_base<Self, Ch, Tr, Alloc, Mode>::push_impl(const T&, std::streamsize, std::streamsize) [with T = boost::iostreams::basic_bzip2_compressor<>; Self = boost::iostreams::chain<boost::iostreams::input, char, std::char_traits<char>, std::allocator<char> >; Ch = char; Tr = std::char_traits<char>; Alloc = std::allocator<char>; Mode = boost::iostreams::input; std::streamsize = long int]’
/usr/local/include/boost/iostreams/chain.hpp:216:1:   required from ‘void boost::iostreams::detail::chain_base<Self, Ch, Tr, Alloc, Mode>::push(const T&, std::streamsize, std::streamsize, typename boost::disable_if<boost::iostreams::is_std_io<T> >::type*) [with T = boost::iostreams::basic_bzip2_compressor<>; Self = boost::iostreams::chain<boost::iostreams::input, char, std::char_traits<char>, std::allocator<char> >; Ch = char; Tr = std::char_traits<char>; Alloc = std::allocator<char>; Mode = boost::iostreams::input; std::streamsize = long int; typename boost::disable_if<boost::iostreams::is_std_io<T> >::type = void]’
/usr/local/include/boost/iostreams/chain.hpp:496:7:   required from ‘void boost::iostreams::detail::chain_client<Chain>::push_impl(const T&, std::streamsize, std::streamsize) [with T = boost::iostreams::basic_bzip2_compressor<>; Chain = boost::iostreams::chain<boost::iostreams::input, char, std::char_traits<char>, std::allocator<char> >; std::streamsize = long int]’
/usr/local/include/boost/iostreams/chain.hpp:484:1:   required from ‘void boost::iostreams::detail::chain_client<Chain>::push(const T&, std::streamsize, std::streamsize, typename boost::disable_if<boost::iostreams::is_std_io<T> >::type*) [with T = boost::iostreams::basic_bzip2_compressor<>; Chain = boost::iostreams::chain<boost::iostreams::input, char, std::char_traits<char>, std::allocator<char> >; std::streamsize = long int; typename boost::disable_if<boost::iostreams::is_std_io<T> >::type = void]’
simple.cpp:6:47:   required from here
/usr/local/include/boost/iostreams/detail/wrap_unwrap.hpp:53:14: error: use of deleted function ‘boost::iostreams::basic_bzip2_compressor<>::basic_bzip2_compressor(const boost::iostreams::basic_bzip2_compressor<>&)’
In file included from simple.cpp:2:0:
/usr/local/include/boost/iostreams/filter/bzip2.hpp:239:8: note: ‘boost::iostreams::basic_bzip2_compressor<>::basic_bzip2_compressor(const boost::iostreams::basic_bzip2_compressor<>&)’ is implicitly deleted because the default definition would be ill-formed:
/usr/local/include/boost/iostreams/filter/bzip2.hpp:239:8: error: use of deleted function ‘boost::iostreams::symmetric_filter<boost::iostreams::detail::bzip2_compressor_impl<std::allocator<char> >, std::allocator<char> >::symmetric_filter(const boost::iostreams::symmetric_filter<boost::iostreams::detail::bzip2_compressor_impl<std::allocator<char> >, std::allocator<char> >&)’
In file included from /usr/local/include/boost/iostreams/filter/bzip2.hpp:29:0,
                 from simple.cpp:2:
/usr/local/include/boost/iostreams/filter/symmetric.hpp:72:7: note: ‘boost::iostreams::symmetric_filter<boost::iostreams::detail::bzip2_compressor_impl<std::allocator<char> >, std::allocator<char> >::symmetric_filter(const boost::iostreams::symmetric_filter<boost::iostreams::detail::bzip2_compressor_impl<std::allocator<char> >, std::allocator<char> >&)’ is implicitly deleted because the default definition would be ill-formed:
/usr/local/include/boost/iostreams/filter/symmetric.hpp:72:7: error: use of deleted function ‘boost::shared_ptr<boost::iostreams::symmetric_filter<boost::iostreams::detail::bzip2_compressor_impl<std::allocator<char> >, std::allocator<char> >::impl>::shared_ptr(const boost::shared_ptr<boost::iostreams::symmetric_filter<boost::iostreams::detail::bzip2_compressor_impl<std::allocator<char> >, std::allocator<char> >::impl>&)’
In file included from /usr/local/include/boost/shared_ptr.hpp:17:0,
                 from /usr/local/include/boost/iostreams/chain.hpp:37,
                 from /usr/local/include/boost/iostreams/filtering_streambuf.hpp:17,
                 from /usr/local/include/boost/iostreams/filtering_stream.hpp:22,
                 from simple.cpp:1:
/usr/local/include/boost/smart_ptr/shared_ptr.hpp:168:25: note: ‘boost::shared_ptr<boost::iostreams::symmetric_filter<boost::iostreams::detail::bzip2_compressor_impl<std::allocator<char> >, std::allocator<char> >::impl>::shared_ptr(const boost::shared_ptr<boost::iostreams::symmetric_filter<boost::iostreams::detail::bzip2_compressor_impl<std::allocator<char> >, std::allocator<char> >::impl>&)’ is implicitly declared as deleted because ‘boost::shared_ptr<boost::iostreams::symmetric_filter<boost::iostreams::detail::bzip2_compressor_impl<std::allocator<char> >, std::allocator<char> >::impl>’ declares a move constructor or move assignment operator
In file included from /usr/local/include/boost/iostreams/detail/streambuf/indirect_streambuf.hpp:23:0,
                 from /usr/local/include/boost/iostreams/stream_buffer.hpp:22,
                 from /usr/local/include/boost/iostreams/chain.hpp:35,
                 from /usr/local/include/boost/iostreams/filtering_streambuf.hpp:17,
                 from /usr/local/include/boost/iostreams/filtering_stream.hpp:22,
                 from simple.cpp:1:
/usr/local/include/boost/iostreams/detail/adapter/concept_adapter.hpp: In instantiation of ‘boost::iostreams::detail::concept_adapter<T>::concept_adapter(const T&) [with T = boost::iostreams::basic_bzip2_compressor<>]’:
/usr/local/include/boost/iostreams/detail/streambuf/indirect_streambuf.hpp:187:5:   required from ‘void boost::iostreams::detail::indirect_streambuf<T, Tr, Alloc, Mode>::open(const T&, std::streamsize, std::streamsize) [with T = boost::iostreams::basic_bzip2_compressor<>; Tr = std::char_traits<char>; Alloc = std::allocator<char>; Mode = boost::iostreams::input; std::streamsize = long int]’
/usr/local/include/boost/iostreams/stream_buffer.hpp:106:13:   required from ‘void boost::iostreams::stream_buffer<T, Tr, Alloc, Mode>::open_impl(const T&, std::streamsize, std::streamsize) [with T = boost::iostreams::basic_bzip2_compressor<>; Tr = std::char_traits<char>; Alloc = std::allocator<char>; Mode = boost::iostreams::input; std::streamsize = long int]’
/usr/local/include/boost/iostreams/stream_buffer.hpp:94:5:   required from ‘boost::iostreams::stream_buffer<T, Tr, Alloc, Mode>::stream_buffer(const T&, std::streamsize, std::streamsize) [with T = boost::iostreams::basic_bzip2_compressor<>; Tr = std::char_traits<char>; Alloc = std::allocator<char>; Mode = boost::iostreams::input; std::streamsize = long int]’
/usr/local/include/boost/iostreams/chain.hpp:257:60:   required from ‘void boost::iostreams::detail::chain_base<Self, Ch, Tr, Alloc, Mode>::push_impl(const T&, std::streamsize, std::streamsize) [with T = boost::iostreams::basic_bzip2_compressor<>; Self = boost::iostreams::chain<boost::iostreams::input, char, std::char_traits<char>, std::allocator<char> >; Ch = char; Tr = std::char_traits<char>; Alloc = std::allocator<char>; Mode = boost::iostreams::input; std::streamsize = long int]’
/usr/local/include/boost/iostreams/chain.hpp:216:1:   required from ‘void boost::iostreams::detail::chain_base<Self, Ch, Tr, Alloc, Mode>::push(const T&, std::streamsize, std::streamsize, typename boost::disable_if<boost::iostreams::is_std_io<T> >::type*) [with T = boost::iostreams::basic_bzip2_compressor<>; Self = boost::iostreams::chain<boost::iostreams::input, char, std::char_traits<char>, std::allocator<char> >; Ch = char; Tr = std::char_traits<char>; Alloc = std::allocator<char>; Mode = boost::iostreams::input; std::streamsize = long int; typename boost::disable_if<boost::iostreams::is_std_io<T> >::type = void]’
/usr/local/include/boost/iostreams/chain.hpp:496:7:   required from ‘void boost::iostreams::detail::chain_client<Chain>::push_impl(const T&, std::streamsize, std::streamsize) [with T = boost::iostreams::basic_bzip2_compressor<>; Chain = boost::iostreams::chain<boost::iostreams::input, char, std::char_traits<char>, std::allocator<char> >; std::streamsize = long int]’
/usr/local/include/boost/iostreams/chain.hpp:484:1:   required from ‘void boost::iostreams::detail::chain_client<Chain>::push(const T&, std::streamsize, std::streamsize, typename boost::disable_if<boost::iostreams::is_std_io<T> >::type*) [with T = boost::iostreams::basic_bzip2_compressor<>; Chain = boost::iostreams::chain<boost::iostreams::input, char, std::char_traits<char>, std::allocator<char> >; std::streamsize = long int; typename boost::disable_if<boost::iostreams::is_std_io<T> >::type = void]’
simple.cpp:6:47:   required from here
/usr/local/include/boost/iostreams/detail/adapter/concept_adapter.hpp:67:48: error: use of deleted function ‘boost::iostreams::basic_bzip2_compressor<>::basic_bzip2_compressor(const boost::iostreams::basic_bzip2_compressor<>&)’
In file included from /usr/local/include/boost/iostreams/detail/streambuf/direct_streambuf.hpp:26:0,
                 from /usr/local/include/boost/iostreams/stream_buffer.hpp:21,
                 from /usr/local/include/boost/iostreams/chain.hpp:35,
                 from /usr/local/include/boost/iostreams/filtering_streambuf.hpp:17,
                 from /usr/local/include/boost/iostreams/filtering_stream.hpp:22,
                 from simple.cpp:1:
/usr/local/include/boost/iostreams/detail/optional.hpp: In instantiation of ‘void boost::iostreams::detail::optional<T>::reset(const T&) [with T = boost::iostreams::detail::concept_adapter<boost::iostreams::basic_bzip2_compressor<> >]’:
/usr/local/include/boost/iostreams/detail/streambuf/indirect_streambuf.hpp:187:5:   required from ‘void boost::iostreams::detail::indirect_streambuf<T, Tr, Alloc, Mode>::open(const T&, std::streamsize, std::streamsize) [with T = boost::iostreams::basic_bzip2_compressor<>; Tr = std::char_traits<char>; Alloc = std::allocator<char>; Mode = boost::iostreams::input; std::streamsize = long int]’
/usr/local/include/boost/iostreams/stream_buffer.hpp:106:13:   required from ‘void boost::iostreams::stream_buffer<T, Tr, Alloc, Mode>::open_impl(const T&, std::streamsize, std::streamsize) [with T = boost::iostreams::basic_bzip2_compressor<>; Tr = std::char_traits<char>; Alloc = std::allocator<char>; Mode = boost::iostreams::input; std::streamsize = long int]’
/usr/local/include/boost/iostreams/stream_buffer.hpp:94:5:   required from ‘boost::iostreams::stream_buffer<T, Tr, Alloc, Mode>::stream_buffer(const T&, std::streamsize, std::streamsize) [with T = boost::iostreams::basic_bzip2_compressor<>; Tr = std::char_traits<char>; Alloc = std::allocator<char>; Mode = boost::iostreams::input; std::streamsize = long int]’
/usr/local/include/boost/iostreams/chain.hpp:257:60:   required from ‘void boost::iostreams::detail::chain_base<Self, Ch, Tr, Alloc, Mode>::push_impl(const T&, std::streamsize, std::streamsize) [with T = boost::iostreams::basic_bzip2_compressor<>; Self = boost::iostreams::chain<boost::iostreams::input, char, std::char_traits<char>, std::allocator<char> >; Ch = char; Tr = std::char_traits<char>; Alloc = std::allocator<char>; Mode = boost::iostreams::input; std::streamsize = long int]’
/usr/local/include/boost/iostreams/chain.hpp:216:1:   required from ‘void boost::iostreams::detail::chain_base<Self, Ch, Tr, Alloc, Mode>::push(const T&, std::streamsize, std::streamsize, typename boost::disable_if<boost::iostreams::is_std_io<T> >::type*) [with T = boost::iostreams::basic_bzip2_compressor<>; Self = boost::iostreams::chain<boost::iostreams::input, char, std::char_traits<char>, std::allocator<char> >; Ch = char; Tr = std::char_traits<char>; Alloc = std::allocator<char>; Mode = boost::iostreams::input; std::streamsize = long int; typename boost::disable_if<boost::iostreams::is_std_io<T> >::type = void]’
/usr/local/include/boost/iostreams/chain.hpp:496:7:   required from ‘void boost::iostreams::detail::chain_client<Chain>::push_impl(const T&, std::streamsize, std::streamsize) [with T = boost::iostreams::basic_bzip2_compressor<>; Chain = boost::iostreams::chain<boost::iostreams::input, char, std::char_traits<char>, std::allocator<char> >; std::streamsize = long int]’
/usr/local/include/boost/iostreams/chain.hpp:484:1:   required from ‘void boost::iostreams::detail::chain_client<Chain>::push(const T&, std::streamsize, std::streamsize, typename boost::disable_if<boost::iostreams::is_std_io<T> >::type*) [with T = boost::iostreams::basic_bzip2_compressor<>; Chain = boost::iostreams::chain<boost::iostreams::input, char, std::char_traits<char>, std::allocator<char> >; std::streamsize = long int; typename boost::disable_if<boost::iostreams::is_std_io<T> >::type = void]’
simple.cpp:6:47:   required from here
/usr/local/include/boost/iostreams/detail/optional.hpp:100:9: error: use of deleted function ‘boost::iostreams::detail::concept_adapter<boost::iostreams::basic_bzip2_compressor<> >::concept_adapter(const boost::iostreams::detail::concept_adapter<boost::iostreams::basic_bzip2_compressor<> >&)’
In file included from /usr/local/include/boost/iostreams/detail/streambuf/indirect_streambuf.hpp:23:0,
                 from /usr/local/include/boost/iostreams/stream_buffer.hpp:22,
                 from /usr/local/include/boost/iostreams/chain.hpp:35,
                 from /usr/local/include/boost/iostreams/filtering_streambuf.hpp:17,
                 from /usr/local/include/boost/iostreams/filtering_stream.hpp:22,
                 from simple.cpp:1:
/usr/local/include/boost/iostreams/detail/adapter/concept_adapter.hpp:38:7: note: ‘boost::iostreams::detail::concept_adapter<boost::iostreams::basic_bzip2_compressor<> >::concept_adapter(const boost::iostreams::detail::concept_adapter<boost::iostreams::basic_bzip2_compressor<> >&)’ is implicitly deleted because the default definition would be ill-formed:
/usr/local/include/boost/iostreams/detail/adapter/concept_adapter.hpp:38:7: error: use of deleted function ‘boost::iostreams::basic_bzip2_compressor<>::basic_bzip2_compressor(const boost::iostreams::basic_bzip2_compressor<>&)’



In file included from /usr/local/include/boost/iostreams/traits.hpp:31:0,
                 from /usr/local/include/boost/iostreams/pipeline.hpp:18,
                 from /usr/local/include/boost/iostreams/detail/push.hpp:22,
                 from /usr/local/include/boost/iostreams/filtering_stream.hpp:19,
                 from simple.cpp:1:
/usr/local/include/boost/iostreams/detail/wrap_unwrap.hpp: In instantiation of ‘T boost::iostreams::detail::wrap(const T&, typename boost::disable_if<boost::iostreams::is_std_io<T> >::type*) [with T = boost::iostreams::basic_bzip2_compressor<>; typename boost::disable_if<boost::iostreams::is_std_io<T> >::type = void]’:
/usr/local/include/boost/iostreams/stream_buffer.hpp:94:5:   required from ‘boost::iostreams::stream_buffer<T, Tr, Alloc, Mode>::stream_buffer(const T&, std::streamsize, std::streamsize) [with T = boost::iostreams::basic_bzip2_compressor<>; Tr = std::char_traits<char>; Alloc = std::allocator<char>; Mode = boost::iostreams::input; std::streamsize = long int]’
/usr/local/include/boost/iostreams/chain.hpp:257:60:   required from ‘void boost::iostreams::detail::chain_base<Self, Ch, Tr, Alloc, Mode>::push_impl(const T&, std::streamsize, std::streamsize) [with T = boost::iostreams::basic_bzip2_compressor<>; Self = boost::iostreams::chain<boost::iostreams::input, char, std::char_traits<char>, std::allocator<char> >; Ch = char; Tr = std::char_traits<char>; Alloc = std::allocator<char>; Mode = boost::iostreams::input; std::streamsize = long int]’

Code compiled with -std=c++0x is not going to be ABI compatible with code compiled without -std=c++0x . You'll need to build Boost yourself with -std=c++0x enabled; this can be done by passing the cxxflags argument to bjam / b2 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM