Opened 10 years ago

Closed 9 years ago

Last modified 9 years ago

#7407 closed Bugs (fixed)

istream_range does not compile with wcin

Reported by: Christopher Yeleighton <giecrilj@…> Owned by: Neil Groves
Milestone: To Be Determined Component: range
Version: Boost 1.51.0 Severity: Problem
Keywords: Cc:

Description

The following code does not compile:

#include <boost/range/istream_range.hpp>
static void trigger () 
{ 
::boost ::istream_range < int > (::std ::cin);
::boost ::istream_range < int > (::std ::wcin); 
}

Result:

In file included from boost.cc:1:0:
/usr/include/boost/range/istream_range.hpp: In instantiation of ‘boost::iterator_range<std::istream_iterator<Type, Elem, Traits> > boost::range::istream_range(std::basic_istream<Elem, Traits>&) [with Type = int; Elem = wchar_t; Traits = std::char_traits<wchar_t>]’:
boost.cc:5:46:   required from here
/usr/include/boost/range/istream_range.hpp:31:46: error: no matching function for call to ‘std::istream_iterator<int, char, std::char_traits<char>, long int>::istream_iterator(std::basic_istream<wchar_t>&)’
/usr/include/boost/range/istream_range.hpp:31:46: note: candidates are:
In file included from /usr/include/c++/4.7/iterator:66:0,
                 from /usr/include/boost/range/istream_range.hpp:16,
                 from boost.cc:1:
/usr/include/c++/4.7/bits/stream_iterator.h:72:7: note: std::istream_iterator<_Tp, _CharT, _Traits, _Dist>::istream_iterator(const std::istream_iterator<_Tp, _CharT, _Traits, _Dist>&) [with _Tp = int; _CharT = char; _Traits = std::char_traits<char>; _Dist = long int; std::istream_iterator<_Tp, _CharT, _Traits, _Dist> = std::istream_iterator<int, char, std::char_traits<char>, long int>]
/usr/include/c++/4.7/bits/stream_iterator.h:72:7: note:   no known conversion for argument 1 from ‘std::basic_istream<wchar_t>’ to ‘const std::istream_iterator<int, char, std::char_traits<char>, long int>&’
/usr/include/c++/4.7/bits/stream_iterator.h:68:7: note: std::istream_iterator<_Tp, _CharT, _Traits, _Dist>::istream_iterator(std::istream_iterator<_Tp, _CharT, _Traits, _Dist>::istream_type&) [with _Tp = int; _CharT = char; _Traits = std::char_traits<char>; _Dist = long int; std::istream_iterator<_Tp, _CharT, _Traits, _Dist>::istream_type = std::basic_istream<char>]
/usr/include/c++/4.7/bits/stream_iterator.h:68:7: note:   no known conversion for argument 1 from ‘std::basic_istream<wchar_t>’ to ‘std::istream_iterator<int, char, std::char_traits<char>, long int>::istream_type& {aka std::basic_istream<char>&}’
/usr/include/c++/4.7/bits/stream_iterator.h:64:26: note: std::istream_iterator<_Tp, _CharT, _Traits, _Dist>::istream_iterator() [with _Tp = int; _CharT = char; _Traits = std::char_traits<char>; _Dist = long int]
/usr/include/c++/4.7/bits/stream_iterator.h:64:26: note:   candidate expects 0 arguments, 1 provided

Change History (5)

comment:1 by viboes, 10 years ago

Component: Nonerange
Owner: set to Neil Groves
Version: Boost 1.52.0Boost 1.51.0

comment:2 by Nathan Ridge, 9 years ago

(In [84707]) [range] Fixed a bug in istream_range() that prevented it from working with character types other than 'char' (refs #7407).

comment:3 by Nathan Ridge, 9 years ago

Thanks for the report! Fixed in trunk.

comment:4 by Nathan Ridge, 9 years ago

Resolution: fixed
Status: newclosed

(In [84823]) [range] Merge Boost.Range bug fixes to release branch (fixes #6944; fixes #7407; fixes #7408; fixes #7731; fixes #7827; fixes #8338; fixes #8453).

comment:5 by Nathan Ridge, 9 years ago

Fixed for 1.54.

Note: See TracTickets for help on using tickets.