[Bug c/50992] abs() and cabs()
bratsinot at gmail dot com
gcc-bugzilla@gcc.gnu.org
Fri Nov 4 15:12:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50992
Alexander <bratsinot at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|Wconversion does not handle |abs() and cabs()
|complex type conversions |
--- Comment #4 from Alexander <bratsinot at gmail dot com> 2011-11-04 15:12:13 UTC ---
(In reply to comment #3)
> #include <complex.h>
>
> extern int abs(int);
> int foo(void) {
> complex double Z = 0.1 + 0.2I;
> return abs(Z);
> }
>
> GCC says nothing with -Wall -Wextra -Wconversion, because
> c-common.c:conversion_warnings() does not handle complex variables.
>
> Clang:
>
> test.c:6:14: warning: implicit conversion discards imaginary component:
> '_Complex double' to 'int' [-Wconversion]
> return abs(Z);
> ~~~ ^
> 1 warning generated.
I noticed. So what? Why was this done?
More information about the Gcc-bugs
mailing list