Incorrect "Value may not fit into receiver" inspection for std::abs

On my computer, the following code 

#include <cstdlib>

int main()
{
int i = 5;
int j = std::abs(i);
}

raises the warning "Values of type 'long' may not fit into the receiver type 'int'. However, there is an int-valued abs function (http://en.cppreference.com/w/cpp/numeric/math/abs), so why is CLion raising this warning? Thanks for the help!

4 comments
Comment actions Permalink

Hi Spencer.

It correctly works in my environment. Could you please specify which OS and CLion version ('About CLion') you are using?

0
Comment actions Permalink

Hi Anna,

I am using Arch Linux with CLion version:

CLion 2016.1.2
Build #CL-145.972, built on May 18, 2016
JRE: 1.8.0_92-b14 amd64
JVM: OpenJDK 64-Bit Server VM by Oracle Corporation

0
Comment actions Permalink

Could you please try CLion 2016.2 EAP? Does the problem occur?

0
Comment actions Permalink

Yes, unfortunately the problem still occurs.

0

Please sign in to leave a comment.