[Boost-bugs] [Boost C++ Libraries] #5793: [date_time] format_date_parser::parse_date does not compile with "Treat wchar_t as builtin type" set to No

Subject: [Boost-bugs] [Boost C++ Libraries] #5793: [date_time] format_date_parser::parse_date does not compile with "Treat wchar_t as builtin type" set to No
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-08-19 14:29:13


#5793: [date_time] format_date_parser::parse_date does not compile with "Treat
wchar_t as builtin type" set to No
------------------------------------------------------------+---------------
 Reporter: Daniel Mitchell <danielmitchell@…> | Owner: az_sw_dude
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: date_time
  Version: Boost 1.47.0 | Severity: Problem
 Keywords: |
------------------------------------------------------------+---------------
 Testing with Boost 1.47, though it reproduces with trunk as of
 19/aug/2011.

 Visual Studio 2008 / 2010; the following code does not compile when built
 with "treat wchar_t as builtin type=no" set in project settings:

 {{{
 #include <boost/date_time/gregorian/gregorian.hpp>
 #include <boost/date_time/posix_time/posix_time.hpp>

 void parseDate()
 {
   std::locale locale;
   boost::date_time::format_date_parser<boost::gregorian::date, wchar_t>
 parser(L"", locale);
   boost::date_time::special_values_parser<boost::gregorian::date, wchar_t>
 svp;

   boost::gregorian::date date = parser.parse_date(L"", L"", svp);
 }
 }}}

  The compile error is:

 {{{
 c:\source\boost\trunk\boost\lexical_cast.hpp(1406): error C2535: 'bool
 boost::detail::lexical_stream_limited_src<CharT,Traits,RequiresStringbuffer>::operator
>>(unsigned short &)' : member function already defined or declared
           with
           [
               CharT=char_type,
               Traits=traits,
               RequiresStringbuffer=false
           ]
           c:\source\boost\trunk\boost\lexical_cast.hpp(1392) : see
 declaration of
 'boost::detail::lexical_stream_limited_src<CharT,Traits,RequiresStringbuffer>::operator
>>'
           with
           [
               CharT=char_type,
               Traits=traits,
               RequiresStringbuffer=false
           ]
           c:\source\boost\trunk\boost\lexical_cast.hpp(1687) : see
 reference to class template instantiation
 'boost::detail::lexical_stream_limited_src<CharT,Traits,RequiresStringbuffer>'
 being compiled
           with
           [
               CharT=char_type,
               Traits=traits,
               RequiresStringbuffer=false
           ]
           c:\source\boost\trunk\boost\lexical_cast.hpp(1653) : while
 compiling class template member function 'short
 boost::detail::lexical_cast_do_cast<Target,Source>::lexical_cast_impl(const
 Source &)'
           with
           [
               Target=short,
               Source=src
           ]
           c:\source\boost\trunk\boost\lexical_cast.hpp(1858) : see
 reference to class template instantiation
 'boost::detail::lexical_cast_do_cast<Target,Source>' being compiled
           with
           [
               Target=short,
               Source=src
           ]
           c:\source\boost\trunk\boost\date_time\format_date_parser.hpp(72)
 : see reference to function template instantiation 'Target
 boost::lexical_cast<int_type,std::basic_string<_Elem,_Traits,_Ax>>(const
 Source &)' being compiled
           with
           [
               Target=short,
               int_type=short,
               _Elem=wchar_t,
               _Traits=std::char_traits<wchar_t>,
               _Ax=std::allocator<wchar_t>,
 Source=std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t>>
           ]
 c:\source\boost\trunk\boost\date_time\format_date_parser.hpp(365) : see
 reference to function template instantiation 'int_type
 boost::date_time::fixed_string_to_int<short,charT>(std::istreambuf_iterator<_Elem,_Traits>
 &,std::istreambuf_iterator<_Elem,_Traits>
 &,boost::date_time::parse_match_result<charT> &,unsigned int,const charT
 &)' being compiled
           with
           [
               int_type=short,
               charT=wchar_t,
               _Elem=wchar_t,
               _Traits=std::char_traits<wchar_t>
           ]
 c:\source\boost\trunk\boost\date_time\format_date_parser.hpp(254) : while
 compiling class template member function 'boost::gregorian::date
 boost::date_time::format_date_parser<date_type,charT>::parse_date(std::istreambuf_iterator<_Elem,_Traits>
 &,std::istreambuf_iterator<_Elem,_Traits>
 &,std::basic_string<_Elem,_Traits,_Ax>,const
 boost::date_time::special_values_parser<date_type,charT> &) const'
           with
           [
               date_type=boost::gregorian::date,
               charT=wchar_t,
               _Elem=wchar_t,
               _Traits=std::char_traits<wchar_t>,
               _Ax=std::allocator<wchar_t>
           ]
 c:\source\dan\boost_wchar_t_test\boost_wchar_t_test\boost_wchar_t_test.cpp(9)
 : see reference to class template instantiation
 'boost::date_time::format_date_parser<date_type,charT>' being compiled
           with
           [
               date_type=boost::gregorian::date,
               charT=wchar_t
           ]
 }}}

  If I set "Treat wchar_t as builtin type" to Yes, then it does compile
 correctly.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/5793>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:07 UTC