Opened 11 years ago

Closed 10 years ago

#6645 closed Bugs (fixed)

lexical_cast<float>("0.0") -> warning:

Reported by: ChristianR <habadaschi@…> Owned by: Antony Polukhin
Milestone: Boost 1.50.0 Component: lexical_cast
Version: Boost 1.49.0 Severity: Optimization
Keywords: lexical_cast float warning Cc: antoshkka@…

Description

float f = boost::lexical_cast<float>("0.123");

compiler warning: boost/boost/lexical_cast.hpp:954: warning: implicit conversion shortens 64-bit value into a 32-bit value

32 and 64 bit with i686-apple-darwin10-gcc-4.2.1 (Xcode 3.2.5)

Change History (4)

comment:1 by ChristianR <habadaschi@…>, 11 years ago

boost/lexical_cast.hpp: In function 'bool boost::detail::lcast_ret_float(T&, const CharT*, const CharT*) [with Traits = std::char_traits<char>, T = float, CharT = char]':

boost/lexical_cast.hpp:1637: instantiated from 'bool boost::detail::lexical_stream_limited_src<CharT, Traits, RequiresStringbuffer>::operator>>(float&) [with CharT = char, Traits = std::char_traits<char>, bool RequiresStringbuffer = true]'

boost/lexical_cast.hpp:1920: instantiated from 'static Target boost::detail::lexical_cast_do_cast<Target, Source>::lexical_cast_impl(const Source&) [with Target = float, Source = const char*]'

boost/lexical_cast.hpp:2087: instantiated from 'Target boost::lexical_cast(const Source&) [with Target = float, Source = char [6]]'

sandbox.cpp:149: instantiated from here

boost/lexical_cast.hpp:954: warning: implicit conversion shortens 64-bit value into a 32-bit value

comment:2 by Antony Polukhin, 11 years ago

Cc: antoshkka@… added
Status: newassigned

Changes were made in trunk at r77221 to suppress this warning.
can you reproduce it now?

comment:3 by anonymous, 11 years ago

I don't see it anymore. Thanks.

comment:4 by Antony Polukhin, 10 years ago

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.