Opened 12 years ago

Closed 12 years ago

#4940 closed Bugs (invalid)

Problem with construcotr of file_descriptor_sink class.

Reported by: anonymous Owned by: Jonathan Turkanis
Milestone: To Be Determined Component: iostreams
Version: Boost 1.45.0 Severity: Problem
Keywords: Cc: osmano807@…

Description

$ cat test.cpp 
#include <boost/iostreams/device/file_descriptor.hpp>
#include <boost/iostreams/stream.hpp>

using namespace boost::iostreams;

class fdstream : public stream<file_descriptor_sink>
{
public:
    fdstream(int fd): stream<file_descriptor_sink>(fd) {}
};

$ gcc test.cpp -o test
/usr/include/boost/iostreams/device/file_descriptor.hpp: In constructor 'boost::iostreams::file_descriptor_sink::file_descriptor_sink(const Path&, std::_Ios_Openmode) [with Path = int]':
/usr/include/boost/iostreams/stream.hpp:130:   instantiated from 'boost::iostreams::stream<Device, Tr, Alloc>::stream(U100&, typename boost::disable_if<boost::is_same<U0, T>, void>::type*) [with U100 = int, Device = boost::iostreams::file_descriptor_sink, Tr = std::char_traits<char>, Alloc = std::allocator<char>]'
test.cpp:9:   instantiated from here
/usr/include/boost/iostreams/device/file_descriptor.hpp:276: error: call of overloaded 'path(const int&)' is ambiguous
/usr/include/boost/iostreams/detail/path.hpp:111: note: candidates are: boost::iostreams::detail::path::path(const std::wstring&) <near match>
/usr/include/boost/iostreams/detail/path.hpp:58: note:                 boost::iostreams::detail::path::path(const boost::iostreams::detail::path&) <near match>
/usr/include/boost/iostreams/detail/path.hpp:47: note:                 boost::iostreams::detail::path::path(const char*) <near match>
/usr/include/boost/iostreams/detail/path.hpp:44: note:                 boost::iostreams::detail::path::path(const std::string&) <near match>

Attachments (1)

clang.log (7.9 KB ) - added by osmano807@… 12 years ago.
Log output when compilling with clang

Download all attachments as: .zip

Change History (4)

by osmano807@…, 12 years ago

Attachment: clang.log added

Log output when compilling with clang

comment:1 by osmano807@…, 12 years ago

Cc: osmano807@… added

comment:2 by Steven Watanabe, 12 years ago

The constructor you're trying to use is deprecated and has been disabled by default. See http://www.boost.org/doc/libs/1_45_0/libs/iostreams/doc/classes/file_descriptor.html#file_descriptor_sink.

Whoops. It looks like the wrong constructor was marked as deprecated in the docs. I'll fix that.

comment:3 by Steven Watanabe, 12 years ago

Resolution: invalid
Status: newclosed

To enable this constructor compile with -DBOOST_IOSTREAMS_USE_DEPRECATED.

Note: See TracTickets for help on using tickets.