re PR c/48956 (-Wconversion should warn when a complex value is assigned to a real...
authorMikhail Maltsev <maltsevm@gmail.com>
Fri, 15 May 2015 18:02:50 +0000 (18:02 +0000)
committerMikhail Maltsev <miyuki@gcc.gnu.org>
Fri, 15 May 2015 18:02:50 +0000 (18:02 +0000)
commit7a37fa90703f62301130a3e1ef7ad4fade1bd786
treeb968572ca494984649ee737b7d8ba1f7d14c5580
parentbc4315fbb0075e29d9a246bf73ff4c56ccf8fa6b
re PR c/48956 (-Wconversion should warn when a complex value is assigned to a real result)

PR c/48956

gcc/c-family/
* c-common.c (int_safely_convertible_to_real_p): Define.
(unsafe_conversion_p): Check conversions involving complex types.
(conversion_warning): Add new warning message for conversions which
discard imaginary component.
* c-common.h: (enum conversion_safety): Add new enumerator for such
conversions.

gcc/testsuite/
* gcc.dg/Wconversion-complex-c99.c: New test.
* gcc.dg/Wconversion-complex-gnu.c: New test.

From-SVN: r223223
gcc/c-family/ChangeLog
gcc/c-family/c-common.c
gcc/c-family/c-common.h
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/Wconversion-complex-c99.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/Wconversion-complex-gnu.c [new file with mode: 0644]