Re: [Boost-bugs] [Boost C++ Libraries] #6186: lexical_cast on vs2005 with wchar_t-

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #6186: lexical_cast on vs2005 with wchar_t-
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-12-13 19:22:26


#6186: lexical_cast on vs2005 with wchar_t-
-------------------------------+--------------------------------------------
  Reporter: anonymous | Owner: apolukhin
      Type: Bugs | Status: closed
 Milestone: To Be Determined | Component: lexical_cast
   Version: Boost 1.48.0 | Severity: Problem
Resolution: fixed | Keywords:
-------------------------------+--------------------------------------------

Comment (by cheng.yang <luckyangcheng@…>):

 Hi, apolukhin

 I have gone through your fix in trunk and find there still has the
 problem.

 If BOOST_NO_INTRINSIC_WCHAR_T is defined, then wchar_t will be defined as
 unsigned short.

 And now, ushort_ambiguity_workaround will be deduced as
 type_used_as_workaround_for_typedefed_wchar_ts, so in the class, it add an
 overload function
 bool operator>>(type_used_as_workaround_for_typedefed_wchar_ts& output)
 which will call a private function.

 But, the overload function will never be called, because no one will
 generate such a object do lexical_cast. If user call operator>>(wchar_t)
 will use the function operator>>(unsigned short&). So your fix has no
 difference with mine.

 If the wchar_t type cannot be treated as unsigned short, the fix should as
 following:

 #ifndef BOOST_NO_INTRINSIC_WCHAR_T
             bool operator>>(unsigned short& output) { return
 shr_unsigned(output); }
             bool operator>>(wchar_t& output) { return
 shr_xchar(output); }
 #else
             bool operator>>(wchar_t& output) { return
 shr_xchar(output); }
 #endif
 at the same time, remove line 1440.

             bool operator>>(unsigned short& output) { return
 shr_unsigned(output); }

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/6186#comment:6>
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:08 UTC