[Boost-bugs] [Boost C++ Libraries] #10520: Conversion warning in intrusive/detail/utilities.hpp

Subject: [Boost-bugs] [Boost C++ Libraries] #10520: Conversion warning in intrusive/detail/utilities.hpp
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-09-20 16:47:53


#10520: Conversion warning in intrusive/detail/utilities.hpp
------------------------------+------------------------
 Reporter: mbradle@… | Owner: igaztanaga
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: intrusive
  Version: Boost 1.56.0 | Severity: Cosmetic
 Keywords: |
------------------------------+------------------------
 Hello,

 When I compile the following simple code test.cpp

 {{{
 #include <boost/intrusive/detail/utilities.hpp>

 int main()
 {
   return 0;
 }
 }}}
 with g++ version 4.8.1, Boost 1.56, and the compilation line
 {{{
 g++ -I/home/mbradle/boost -Wconversion test.cpp
 }}}
 I get the warning
 {{{
 In file included from test.cpp:1:0:
 /home/mbradle/boost/boost/intrusive/detail/utilities.hpp: In function
 â€˜float boost::intrusive::detail::fast_log2(float)’:
 /home/mbradle/boost/boost/intrusive/detail/utilities.hpp:592:18: warning:
 conversion to ‘float’ from ‘int’ may alter its value [-Wconversion]
     return (val + log_2);
                   ^
 }}}
 Casting log_2 as a float removes the warning, but, given that I do not get
 this warning if I compile against Boost 1.55 and that I see no difference
 between the fast_log2 routines in the two versions, I suspect that casting
 is not the correct fix. Thanks, and best wishes.

 Brad Meyer

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