[pkg-boost-devel] Bug#448576: libboost-dev: format_date_parser::parse_date(string, string, special) doesn't compile due to wrong stringstream_type

Max Kirillov max630 at mail.ru
Tue Oct 30 05:04:01 UTC 2007

Package: libboost-dev
Version: 1.34.1-2
Severity: important

consider this code:
#include <boost/date_time/gregorian/greg_date.hpp>
#include <boost/date_time/format_date_parser.hpp>
#include <boost/date_time/special_values_parser.hpp>
#include <locale>

main ()
  boost::date_time::format_date_parser<boost::gregorian::date, char>
      parser(std::string("%Y-%m-%d"), std::locale("C"));
  boost::date_time::special_values_parser<boost::gregorian::date, char>
	  special_parser("a", "a", "a", "a", "a");
  parser.parse_date("2007-01-01", "%Y-%m-%d", special_parser);
  return 0;

it failed to compile with the following message (strings wrapped):
max at src$g++ 1.cpp
/usr/include/boost/date_time/format_date_parser.hpp: In member function
'date_type boost::date_time::format_date_parser<date_type,
charT>::parse_date(const std::basic_string<charT, std::char_traits<_CharT>,
std::allocator<_T2> >&, const std::basic_string<charT,
std::char_traits<_CharT>, std::allocator<_T2> >&, const
boost::date_time::special_values_parser<date_type, charT>&) const [with
date_type = boost::gregorian::date, charT = char]':
1.cpp:13:   instantiated from here
/usr/include/boost/date_time/format_date_parser.hpp:221: error: invalid
conversion from 'void*' to 'std::basic_streambuf<char, std::char_traits<char>
/usr/include/boost/date_time/format_date_parser.hpp:221: error:   initializing
argument 1 of 'std::istreambuf_iterator<_CharT,
_Traits>::istreambuf_iterator(std::basic_streambuf<_CharT, _Traits>*) [with
_CharT = char, _Traits = std::char_traits<char>]'

the code in the header is:
  typedef std::basic_ostringstream<charT>  stringstream_type;
  typedef std::istreambuf_iterator<charT> stream_itr_type;


  parse_date(const string_type& value, 
             const string_type& format_str,
             const special_values_parser<date_type,charT>& sv_parser) const
    stringstream_type ss;
    ss << value; 
    stream_itr_type sitr(ss);
    stream_itr_type stream_end;
    return parse_date(sitr, stream_end, format_str, sv_parser);

I think, istream_iterator should not be constructed from ostream.

PS: I should report it to the upstream but have problems
with their trac form, please somebody tell them.

-- System Information:
Debian Release: lenny/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (500, 'stable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.21-2-686
Locale: LANG=C, LC_CTYPE=ru_RU.KOI8-R (charmap=KOI8-R)

Versions of packages libboost-dev depends on:
ii  libstdc++5-3.3-dev [libstdc++ 1:3.3.5-13 The GNU Standard C++ Library v3 (d
ii  libstdc++6-4.0-dev [libstdc++ 4.0.3-3    The GNU Standard C++ Library v3 (d
ii  libstdc++6-4.1-dev [libstdc++ 4.1.1-21   The GNU Standard C++ Library v3 (d
ii  libstdc++6-dev [libstdc++-dev 3.4.6-1    The GNU Standard C++ Library v3 (d

libboost-dev recommends no packages.

-- debconf-show failed

More information about the pkg-boost-devel mailing list