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 (, so why is CLion raising this warning? Thanks for the help!

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?

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

Comment actions Permalink

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

Comment actions Permalink

Yes, unfortunately the problem still occurs.


Please sign in to leave a comment.