Opened 7 years ago
Last modified 6 years ago
#12129 new Bugs
C++11 / C++14 compability in boost/iostreams
| Reported by: | Owned by: | Jonathan Turkanis | |
|---|---|---|---|
| Milestone: | To Be Determined | Component: | iostreams | 
| Version: | Boost Development Trunk | Severity: | Problem | 
| Keywords: | Cc: | 
Description
Hi,
with this code
#include <fstream>
#include <iostream>
#include <boost/iostreams/filtering_stream.hpp>
#include <boost/iostreams/copy.hpp>
#include <boost/iostreams/filter/zlib.hpp>
int main() 
{
    using namespace std;
    ifstream file("hello.z", ios_base::in | ios_base::binary);
    boost::iostreams::filtering_stream<boost::iostreams::input> in;
    in.push(boost::iostreams::zlib_decompressor());
    in.push(file);
    boost::iostreams::copy(in, cout);
}
The current trunk compiles. However, if the -std=c++11 or -std=c++14 flags are specified with gcc (tested versions 4.9.2 and 5.3.0) the following error is displayd:
In file included from /usr/include/boost/iostreams/traits.hpp:31:0,
                 from /usr/include/boost/iostreams/pipeline.hpp:18,
                 from /usr/include/boost/iostreams/detail/push.hpp:22,
                 from /usr/include/boost/iostreams/filtering_stream.hpp:19,
                 from test.cpp:3:
/usr/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_zlib_decompressor<>; typename boost::disable_if<boost::iostreams::is_std_io<T> >::type = void]’:
/usr/include/boost/iostreams/stream_buffer.hpp:93:5:   required from ‘boost::iostreams::stream_buffer<T, Tr, Alloc, Mode>::stream_buffer(const T&, int, int) [with T = boost::iostreams::basic_zlib_decompressor<>; Tr = std::char_traits<char>; Alloc = std::allocator<char>; Mode = boost::iostreams::input]’
/usr/include/boost/iostreams/chain.hpp:252:60:   required from ‘void boost::iostreams::detail::chain_base<Self, Ch, Tr, Alloc, Mode>::push_impl(const T&, int, int) [with T = boost::iostreams::basic_zlib_decompressor<>; 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]’
/usr/include/boost/iostreams/chain.hpp:212:5:   required from ‘void boost::iostreams::detail::chain_base<Self, Ch, Tr, Alloc, Mode>::push(const T&, int, int, typename boost::disable_if<boost::iostreams::is_std_io<T> >::type*) [with T = boost::iostreams::basic_zlib_decompressor<>; 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; typename boost::disable_if<boost::iostreams::is_std_io<T> >::type = void]’
/usr/include/boost/iostreams/chain.hpp:491:7:   required from ‘void boost::iostreams::detail::chain_client<Chain>::push_impl(const T&, int, int) [with T = boost::iostreams::basic_zlib_decompressor<>; Chain = boost::iostreams::chain<boost::iostreams::input, char, std::char_traits<char>, std::allocator<char> >]’
/usr/include/boost/iostreams/chain.hpp:479:5:   required from ‘void boost::iostreams::detail::chain_client<Chain>::push(const T&, int, int, typename boost::disable_if<boost::iostreams::is_std_io<T> >::type*) [with T = boost::iostreams::basic_zlib_decompressor<>; Chain = boost::iostreams::chain<boost::iostreams::input, char, std::char_traits<char>, std::allocator<char> >; typename boost::disable_if<boost::iostreams::is_std_io<T> >::type = void]’
test.cpp:13:50:   required from here
/usr/include/boost/iostreams/detail/wrap_unwrap.hpp:53:14: error: use of deleted function ‘boost::iostreams::basic_zlib_decompressor<>::basic_zlib_decompressor(const boost::iostreams::basic_zlib_decompressor<>&)’
     { return t; }
              ^
In file included from test.cpp:5:0:
/usr/include/boost/iostreams/filter/zlib.hpp:280:8: note: ‘boost::iostreams::basic_zlib_decompressor<>::basic_zlib_decompressor(const boost::iostreams::basic_zlib_decompressor<>&)’ is implicitly deleted because the default definition would be ill-formed:
 struct basic_zlib_decompressor 
        ^
/usr/include/boost/iostreams/filter/zlib.hpp:280:8: error: use of deleted function ‘boost::iostreams::symmetric_filter<boost::iostreams::detail::zlib_decompressor_impl<std::allocator<char> >, std::allocator<char> >::symmetric_filter(const boost::iostreams::symmetric_filter<boost::iostreams::detail::zlib_decompressor_impl<std::allocator<char> >, std::allocator<char> >&)’
In file included from /usr/include/boost/iostreams/filter/zlib.hpp:31:0,
                 from test.cpp:5:
/usr/include/boost/iostreams/filter/symmetric.hpp:72:7: note: ‘boost::iostreams::symmetric_filter<boost::iostreams::detail::zlib_decompressor_impl<std::allocator<char> >, std::allocator<char> >::symmetric_filter(const boost::iostreams::symmetric_filter<boost::iostreams::detail::zlib_decompressor_impl<std::allocator<char> >, std::allocator<char> >&)’ is implicitly deleted because the default definition would be ill-formed:
 class symmetric_filter {
       ^
/usr/include/boost/iostreams/filter/symmetric.hpp:72:7: error: use of deleted function ‘boost::shared_ptr<boost::iostreams::symmetric_filter<boost::iostreams::detail::zlib_decompressor_impl<std::allocator<char> >, std::allocator<char> >::impl>::shared_ptr(const boost::shared_ptr<boost::iostreams::symmetric_filter<boost::iostreams::detail::zlib_decompressor_impl<std::allocator<char> >, std::allocator<char> >::impl>&)’
In file included from /usr/include/boost/shared_ptr.hpp:17:0,
                 from /usr/include/boost/iostreams/chain.hpp:37,
                 from /usr/include/boost/iostreams/filtering_streambuf.hpp:17,
                 from /usr/include/boost/iostreams/filtering_stream.hpp:22,
                 from test.cpp:3:
/usr/include/boost/smart_ptr/shared_ptr.hpp:168:25: note: ‘boost::shared_ptr<boost::iostreams::symmetric_filter<boost::iostreams::detail::zlib_decompressor_impl<std::allocator<char> >, std::allocator<char> >::impl>::shared_ptr(const boost::shared_ptr<boost::iostreams::symmetric_filter<boost::iostreams::detail::zlib_decompressor_impl<std::allocator<char> >, std::allocator<char> >::impl>&)’ is implicitly declared as deleted because ‘boost::shared_ptr<boost::iostreams::symmetric_filter<boost::iostreams::detail::zlib_decompressor_impl<std::allocator<char> >, std::allocator<char> >::impl>’ declares a move constructor or move assignment operator
 template<class T> class shared_ptr
                         ^
In file included from /usr/include/boost/iostreams/detail/streambuf/indirect_streambuf.hpp:23:0,
                 from /usr/include/boost/iostreams/stream_buffer.hpp:22,
                 from /usr/include/boost/iostreams/chain.hpp:35,
                 from /usr/include/boost/iostreams/filtering_streambuf.hpp:17,
                 from /usr/include/boost/iostreams/filtering_stream.hpp:22,
                 from test.cpp:3:
/usr/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_zlib_decompressor<>]’:
/usr/include/boost/iostreams/detail/streambuf/indirect_streambuf.hpp:186:5:   required from ‘void boost::iostreams::detail::indirect_streambuf<T, Tr, Alloc, Mode>::open(const T&, int, int) [with T = boost::iostreams::basic_zlib_decompressor<>; Tr = std::char_traits<char>; Alloc = std::allocator<char>; Mode = boost::iostreams::input]’
/usr/include/boost/iostreams/stream_buffer.hpp:103:28:   required from ‘void boost::iostreams::stream_buffer<T, Tr, Alloc, Mode>::open_impl(const T&, int, int) [with T = boost::iostreams::basic_zlib_decompressor<>; Tr = std::char_traits<char>; Alloc = std::allocator<char>; Mode = boost::iostreams::input]’
/usr/include/boost/iostreams/stream_buffer.hpp:93:5:   required from ‘boost::iostreams::stream_buffer<T, Tr, Alloc, Mode>::stream_buffer(const T&, int, int) [with T = boost::iostreams::basic_zlib_decompressor<>; Tr = std::char_traits<char>; Alloc = std::allocator<char>; Mode = boost::iostreams::input]’
/usr/include/boost/iostreams/chain.hpp:252:60:   required from ‘void boost::iostreams::detail::chain_base<Self, Ch, Tr, Alloc, Mode>::push_impl(const T&, int, int) [with T = boost::iostreams::basic_zlib_decompressor<>; 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]’
/usr/include/boost/iostreams/chain.hpp:212:5:   required from ‘void boost::iostreams::detail::chain_base<Self, Ch, Tr, Alloc, Mode>::push(const T&, int, int, typename boost::disable_if<boost::iostreams::is_std_io<T> >::type*) [with T = boost::iostreams::basic_zlib_decompressor<>; 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; typename boost::disable_if<boost::iostreams::is_std_io<T> >::type = void]’
/usr/include/boost/iostreams/chain.hpp:491:7:   required from ‘void boost::iostreams::detail::chain_client<Chain>::push_impl(const T&, int, int) [with T = boost::iostreams::basic_zlib_decompressor<>; Chain = boost::iostreams::chain<boost::iostreams::input, char, std::char_traits<char>, std::allocator<char> >]’
/usr/include/boost/iostreams/chain.hpp:479:5:   required from ‘void boost::iostreams::detail::chain_client<Chain>::push(const T&, int, int, typename boost::disable_if<boost::iostreams::is_std_io<T> >::type*) [with T = boost::iostreams::basic_zlib_decompressor<>; Chain = boost::iostreams::chain<boost::iostreams::input, char, std::char_traits<char>, std::allocator<char> >; typename boost::disable_if<boost::iostreams::is_std_io<T> >::type = void]’
test.cpp:13:50:   required from here
/usr/include/boost/iostreams/detail/adapter/concept_adapter.hpp:64:48: error: use of deleted function ‘boost::iostreams::basic_zlib_decompressor<>::basic_zlib_decompressor(const boost::iostreams::basic_zlib_decompressor<>&)’
     explicit concept_adapter(const T& t) : t_(t)
                                                ^
In file included from /usr/include/boost/iostreams/detail/streambuf/direct_streambuf.hpp:26:0,
                 from /usr/include/boost/iostreams/stream_buffer.hpp:21,
                 from /usr/include/boost/iostreams/chain.hpp:35,
                 from /usr/include/boost/iostreams/filtering_streambuf.hpp:17,
                 from /usr/include/boost/iostreams/filtering_stream.hpp:22,
                 from test.cpp:3:
/usr/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_zlib_decompressor<> >]’:
/usr/include/boost/iostreams/detail/streambuf/indirect_streambuf.hpp:186:5:   required from ‘void boost::iostreams::detail::indirect_streambuf<T, Tr, Alloc, Mode>::open(const T&, int, int) [with T = boost::iostreams::basic_zlib_decompressor<>; Tr = std::char_traits<char>; Alloc = std::allocator<char>; Mode = boost::iostreams::input]’
/usr/include/boost/iostreams/stream_buffer.hpp:103:28:   required from ‘void boost::iostreams::stream_buffer<T, Tr, Alloc, Mode>::open_impl(const T&, int, int) [with T = boost::iostreams::basic_zlib_decompressor<>; Tr = std::char_traits<char>; Alloc = std::allocator<char>; Mode = boost::iostreams::input]’
/usr/include/boost/iostreams/stream_buffer.hpp:93:5:   required from ‘boost::iostreams::stream_buffer<T, Tr, Alloc, Mode>::stream_buffer(const T&, int, int) [with T = boost::iostreams::basic_zlib_decompressor<>; Tr = std::char_traits<char>; Alloc = std::allocator<char>; Mode = boost::iostreams::input]’
/usr/include/boost/iostreams/chain.hpp:252:60:   required from ‘void boost::iostreams::detail::chain_base<Self, Ch, Tr, Alloc, Mode>::push_impl(const T&, int, int) [with T = boost::iostreams::basic_zlib_decompressor<>; 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]’
/usr/include/boost/iostreams/chain.hpp:212:5:   required from ‘void boost::iostreams::detail::chain_base<Self, Ch, Tr, Alloc, Mode>::push(const T&, int, int, typename boost::disable_if<boost::iostreams::is_std_io<T> >::type*) [with T = boost::iostreams::basic_zlib_decompressor<>; 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; typename boost::disable_if<boost::iostreams::is_std_io<T> >::type = void]’
/usr/include/boost/iostreams/chain.hpp:491:7:   required from ‘void boost::iostreams::detail::chain_client<Chain>::push_impl(const T&, int, int) [with T = boost::iostreams::basic_zlib_decompressor<>; Chain = boost::iostreams::chain<boost::iostreams::input, char, std::char_traits<char>, std::allocator<char> >]’
/usr/include/boost/iostreams/chain.hpp:479:5:   required from ‘void boost::iostreams::detail::chain_client<Chain>::push(const T&, int, int, typename boost::disable_if<boost::iostreams::is_std_io<T> >::type*) [with T = boost::iostreams::basic_zlib_decompressor<>; Chain = boost::iostreams::chain<boost::iostreams::input, char, std::char_traits<char>, std::allocator<char> >; typename boost::disable_if<boost::iostreams::is_std_io<T> >::type = void]’
test.cpp:13:50:   required from here
/usr/include/boost/iostreams/detail/optional.hpp:100:9: error: use of deleted function ‘boost::iostreams::detail::concept_adapter<boost::iostreams::basic_zlib_decompressor<> >::concept_adapter(const boost::iostreams::detail::concept_adapter<boost::iostreams::basic_zlib_decompressor<> >&)’
         new (address()) T(t); 
         ^
In file included from /usr/include/boost/iostreams/detail/streambuf/indirect_streambuf.hpp:23:0,
                 from /usr/include/boost/iostreams/stream_buffer.hpp:22,
                 from /usr/include/boost/iostreams/chain.hpp:35,
                 from /usr/include/boost/iostreams/filtering_streambuf.hpp:17,
                 from /usr/include/boost/iostreams/filtering_stream.hpp:22,
                 from test.cpp:3:
/usr/include/boost/iostreams/detail/adapter/concept_adapter.hpp:35:7: note: ‘boost::iostreams::detail::concept_adapter<boost::iostreams::basic_zlib_decompressor<> >::concept_adapter(const boost::iostreams::detail::concept_adapter<boost::iostreams::basic_zlib_decompressor<> >&)’ is implicitly deleted because the default definition would be ill-formed:
 class concept_adapter {
       ^
/usr/include/boost/iostreams/detail/adapter/concept_adapter.hpp:35:7: error: use of deleted function ‘boost::iostreams::basic_zlib_decompressor<>::basic_zlib_decompressor(const boost::iostreams::basic_zlib_decompressor<>&)’
Almost the same error shows up when the gzip_decompressor is used to replace the zlib_decompressor.
This bug is also present in the 1.60.0 download.
Thanks for looking into this, Christian
Change History (3)
comment:1 by , 6 years ago
comment:2 by , 6 years ago
| Component: | None → iostreams | 
|---|---|
| Owner: | set to | 
  Note:
 See   TracTickets
 for help on using tickets.
    

Is the description not sufficiently clear or should I provide more details? If so, which?
Best, Christian Meesters