[Boost-bugs] [Boost C++ Libraries] #7679: unhex level 4 compile warning in visual studio

Subject: [Boost-bugs] [Boost C++ Libraries] #7679: unhex level 4 compile warning in visual studio
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-11-10 15:56:10


#7679: unhex level 4 compile warning in visual studio
----------------------------------------------+-----------------------------
 Reporter: Gary Sanders <lex21@…> | Owner: marshall
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: algorithm
  Version: Boost 1.52.0 | Severity: Problem
 Keywords: unhex |
----------------------------------------------+-----------------------------
 The following code generates a level 4 compiler warning in Visual Studio
 2010 and 2012:

 {{{
 #include <string>
 #include <boost/algorithm/hex.hpp>

 int main()
 {
     std::string base = "now is the time";
     std::string hstr = boost::algorithm::hex(base);
     std::string cstr = boost::algorithm::unhex(hstr);
 }
 }}}

 The warnings are:
 {{{
 1>d:\development\libs\boost_1_52_0\boost/algorithm/hex.hpp(137): warning
 C4244: '=' : conversion from 'unsigned int' to 'T', possible loss of data

 1> d:\development\libs\boost_1_52_0\boost/algorithm/hex.hpp(204)
 : see reference to function template instantiation
 'std::back_insert_iterator<_Container>
 boost::algorithm::detail::decode_one<InputIterator,OutputIterator,bool(__cdecl
 *)(Iterator,Iterator)>(InputIterator
 &,InputIterator,OutputIterator,EndPred)' being compiled
 1> with
 1> [
 1> _Container=std::string,
 1>
 InputIterator=std::_String_const_iterator<char,std::char_traits<char>,std::allocator<char>>,
 1> OutputIterator=std::back_insert_iterator<std::string>,
 1>
 Iterator=std::_String_const_iterator<char,std::char_traits<char>,std::allocator<char>>,
 1> EndPred=bool (__cdecl
 *)(std::_String_const_iterator<char,std::char_traits<char>,std::allocator<char>>,std::_String_const_iterator<char,std::char_traits<char>,std::allocator<char>>)
 1> ]
 1> d:\development\libs\boost_1_52_0\boost/algorithm/hex.hpp(237)
 : see reference to function template instantiation 'OutputIterator
 boost::algorithm::unhex<std::_String_const_iterator<_Elem,_Traits,_Alloc>,OutputIterator>(InputIterator,InputIterator,OutputIterator)'
 being compiled
 1> with
 1> [
 1> OutputIterator=std::back_insert_iterator<std::string>,
 1> _Elem=char,
 1> _Traits=std::char_traits<char>,
 1> _Alloc=std::allocator<char>,
 1>
 InputIterator=std::_String_const_iterator<char,std::char_traits<char>,std::allocator<char>>
 1> ]
 1> d:\development\libs\boost_1_52_0\boost/algorithm/hex.hpp(263)
 : see reference to function template instantiation 'OutputIterator
 boost::algorithm::unhex<String,std::back_insert_iterator<_Container>>(const
 Range &,OutputIterator)' being compiled
 1> with
 1> [
 1> OutputIterator=std::back_insert_iterator<std::string>,
 1> String=std::string,
 1> _Container=std::string,
 1> Range=std::string
 1> ]
 1> unhex_bug.cpp(10) : see reference to function template
 instantiation 'String boost::algorithm::unhex<std::string>(const String
 &)' being compiled
 1> with
 1> [
 1> String=std::string
 1> ]
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/7679>
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:11 UTC