Subject: [Boost-bugs] [Boost C++ Libraries] #2045: lexical_cast<std::string> of short unsigned produces warnigns with g++ and -Wsign-promo
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2008-06-24 07:51:16
#2045: lexical_cast<std::string> of short unsigned produces warnigns with g++ and
-Wsign-promo
---------------------------------+------------------------------------------
Reporter: aeriksson_at_[hidden] | Owner: nasonov
Type: Bugs | Status: new
Milestone: Boost 1.36.0 | Component: lexical_cast
Version: Boost 1.35.0 | Severity: Problem
Keywords: |
---------------------------------+------------------------------------------
{{{
#include <boost/lexical_cast.hpp>
void foo() {
short unsigned int x;
boost::lexical_cast<std::string>(x);
}
}}}
Compiled with g++ 4.2.0, boost 1.35.0, and the -Wsign-promo flag this
produces the following warnings:
{{{
/opt/boost/include/boost-1_35/boost/lexical_cast.hpp: In member function
âbool boost::detail::lexical_stream_limited_src<CharT, Base,
Traits>::operator<<(short unsigned int) [with CharT = char, Base =
boost::detail::lexical_streambuf_fake, Traits = std::char_traits<char>]â:
/opt/boost/include/boost-1_35/boost/lexical_cast.hpp:1146: instantiated
from âTarget boost::detail::lexical_cast(typename
boost::call_traits<Source>::param_type, CharT*, size_t) [with Target =
std::basic_string<char, std::char_traits<char>, std::allocator<char> >,
Source = short unsigned int, bool Unlimited = false, CharT = char]â
/opt/boost/include/boost-1_35/boost/lexical_cast.hpp:1170: instantiated
from âTarget boost::lexical_cast(const Source&) [with Target =
std::basic_string<char, std::char_traits<char>, std::allocator<char> >,
Source = short unsigned int]â
lexicalWarning.cpp:5: instantiated from here
/opt/boost/include/boost-1_35/boost/lexical_cast.hpp:910: warning: passing
âshort unsigned intâ chooses âintâ over âlong intâ
/opt/boost/include/boost-1_35/boost/lexical_cast.hpp:910: warning: in
call to âunsigned int boost::detail::lcast_to_unsigned(int)â
}}}
--
Ticket URL: <http://svn.boost.org/trac/boost/ticket/2045>
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:49:58 UTC