On Thu, Mar 6, 2014 at 1:03 PM, David Blaikie <[email protected]> wrote: > On Thu, Mar 6, 2014 at 12:15 PM, Joerg Sonnenberger <[email protected]> > wrote: >> On Thu, Mar 06, 2014 at 04:27:18PM -0000, Marshall Clow wrote: >>> >>> - static_assert((std::is_same<decltype(fabsf(0)), float>::value), ""); >>> - static_assert((std::is_same<decltype(fabsl(0)), long double>::value), >>> ""); >>> - assert(fabs(-1) == 1); >>> + static_assert((std::is_same<decltype(fabsf(0.f)), float>::value), ""); >>> + static_assert((std::is_same<decltype(fabsl(0.L)), long >>> double>::value), ""); >>> + assert(fabs(-1.f) == 1); >> >> This looks bogus as in: it shouldn't warn here. > > What basis did you have in mind? That the constant is in the > representable range for the function being called, even though it's > not of the right type?
I guess it makes sense to warn about fabsf(int), because int->float conversion can be lossy. But surely fabs(int) and fabsl(int) are 100% fine! On the other hand, I guess it doesn't much matter. This is a case where Clang's warnings are a little spammy, but the fixit is still correct and results in better-style code. (Perhaps a good candidate for turning into a remark. ;)) –Arthur _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
