Opened 8 years ago

Closed 8 years ago

#10520 closed Bugs (fixed)

Conversion warning in intrusive/detail/utilities.hpp

Reported by: mbradle@… Owned by: Ion Gaztañaga
Milestone: To Be Determined Component: intrusive
Version: Boost 1.56.0 Severity: Cosmetic
Keywords: Cc:

Description

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

Change History (1)

comment:1 by Ion Gaztañaga, 8 years ago

Resolution: fixed
Status: newclosed

Thanks for the report, casting in the correct answer, maybe in Boost 1.55 this function was not being instantiated. Fixed in:

[develop fac6a8e] Fixes #10520 in Boost Trac

Note: See TracTickets for help on using tickets.