Conversion warning from boost/functional/hash/detail/hash_float_generic.hpp

Hi all --
I'm getting a strange warning from

On Fri, Nov 19, 2010 I wrote:
I'm getting a strange warning from
. What's strange is not the warning, but the circumstances: if I use the boost headers installed in /usr/include, no warning. But if I make a copy of /usr/include/boost and tell the compiler to use the copy, I get a warning. [...] In file included from include/boost/functional/hash/detail/hash_float.hpp:30, from include/boost/functional/hash/hash.hpp:15, from include/boost/functional/hash.hpp:6, from test.cpp:1: include/boost/functional/hash/detail/hash_float_generic.hpp: In function ‘size_t boost::hash_detail::float_hash_impl2(T) [with T = float]’: include/boost/functional/hash/detail/hash_float_generic.hpp:82: instantiated from ‘size_t boost::hash_detail::float_hash_impl(T) [with T = float]’ include/boost/functional/hash/detail/hash_float.hpp:74: instantiated from ‘size_t boost::hash_detail::float_hash_value(T) [with T = float]’ include/boost/functional/hash/hash.hpp:315: instantiated from here include/boost/functional/hash/detail/hash_float_generic.hpp:56: warning: conversion to ‘float’ from ‘size_t’ may alter its value include/boost/functional/hash/detail/hash_float_generic.hpp:82: instantiated from ‘size_t boost::hash_detail::float_hash_impl(T) [with T = float]’ include/boost/functional/hash/detail/hash_float.hpp:74: instantiated from ‘size_t boost::hash_detail::float_hash_value(T) [with T = float]’ include/boost/functional/hash/hash.hpp:315: instantiated from here include/boost/functional/hash/detail/hash_float_generic.hpp:69: warning: conversion to ‘float’ from ‘size_t’ may alter its value
I'm still having no luck here. No idea how to make the warning go away, except by using the version of boost installed in /usr/local (e.g.) rather than a symlink to it. I tried upgrading to GCC 4.4.5 with the same build of boost (1.44.0 built by GCC 4.4.4): no luck. Same result. I *would* upgrade to boost 1.45.0, but I'm having trouble building it (working on that in another thread). Any ideas? Greg

On Fri, Nov 26, 2010 at 3:18 PM, I wrote:
I'm still having no luck here. No idea how to make the warning go away, except by using the version of boost installed in /usr/local (e.g.) rather than a symlink to it.
I tried upgrading to GCC 4.4.5 with the same build of boost (1.44.0 built by GCC 4.4.4): no luck. Same result.
I *would* upgrade to boost 1.45.0, but I'm having trouble building it (working on that in another thread).
I managed to build boost 1.45.0: still the same problem. (I built boost with our previous GCC build, 4.4.4, but reproduced the problem with GCC 4.4.5 + boost 1.45.0. I hope the slight mismatch of compiler version does not matter!) Greg

Sorry I missed this before.
On 19 November 2010 18:16, Greg Ward
I'm getting a strange warning from
. What's strange is not the warning, but the circumstances: if I use the boost headers installed in /usr/include, no warning. But if I make a copy of /usr/include/boost and tell the compiler to use the copy, I get a warning.
IIRC gcc treats any headers under /usr/include as system headers and doesn't print any warnings.
$ /usr/bin/g++ -Wall -Wconversion -c test.cpp -o test.o
I'll look into fixing this but '-Wconversion' isn't normally a warning flag that we test with, so problems with it are quite likely to pop up elsewhere. Daniel
participants (2)
-
Daniel James
-
Greg Ward