id summary reporter owner description type status milestone component version severity resolution keywords cc 2558 Unnecessary conversion warning in lexical_cast Yang Zhang Antony Polukhin "When trying to compile the following against r50058 with g++ -Wconversion: {{{ #include #include using namespace boost; using namespace std; int main() { lexical_cast(3); return 0; } }}} I get: {{{ /home/yang/work/boost/boost/lexical_cast.hpp: In function ‘CharT* boost::detail::lcast_put_unsigned(T, CharT*) [with Traits = std::char_traits, T = unsigned int, CharT = char]’: /home/yang/work/boost/boost/lexical_cast.hpp:848: instantiated from ‘bool boost::detail::lexical_stream_limited_src::operator<<(int) [with CharT = char, Base = boost::detail::lexical_streambuf_fake, Traits = std::char_traits]’ /home/yang/work/boost/boost/lexical_cast.hpp:1142: instantiated from ‘Target boost::detail::lexical_cast(typename boost::call_traits::param_type, CharT*, size_t) [with Target = std::basic_string, std::allocator >, Source = int, bool Unlimited = false, CharT = boost::lexical_cast::char_type]’ /home/yang/work/boost/boost/lexical_cast.hpp:1166: instantiated from ‘Target boost::lexical_cast(const Source&) [with Target = std::basic_string, std::allocator >, Source = int]’ blah.cc:6: instantiated from here /home/yang/work/boost/boost/lexical_cast.hpp:510: warning: conversion to ‘char’ from ‘int’ may alter its value /home/yang/work/boost/boost/lexical_cast.hpp:848: instantiated from ‘bool boost::detail::lexical_stream_limited_src::operator<<(int) [with CharT = char, Base = boost::detail::lexical_streambuf_fake, Traits = std::char_traits]’ /home/yang/work/boost/boost/lexical_cast.hpp:1142: instantiated from ‘Target boost::detail::lexical_cast(typename boost::call_traits::param_type, CharT*, size_t) [with Target = std::basic_string, std::allocator >, Source = int, bool Unlimited = false, CharT = boost::lexical_cast::char_type]’ /home/yang/work/boost/boost/lexical_cast.hpp:1166: instantiated from ‘Target boost::lexical_cast(const Source&) [with Target = std::basic_string, std::allocator >, Source = int]’ blah.cc:6: instantiated from here /home/yang/work/boost/boost/lexical_cast.hpp:512: warning: conversion to ‘char’ from ‘int’ may alter its value /home/yang/work/boost/boost/lexical_cast.hpp:536: warning: conversion to ‘char’ from ‘int’ may alter its value }}} It seems this is because the header is using CHAR_MAX as-is and expecting it to be a char." Bugs closed Boost 1.54.0 lexical_cast Boost Development Trunk Problem fixed