[PATCH] (request for comments) Wcoercion in g++

Manuel López-Ibáñez lopezibanez@gmail.com
Sun Jul 9 18:43:00 GMT 2006


The following patch replaces some of the functionality of Wconversion
in g++ by using the code developed for Wcoercion project. In
particular, it checks for coercions from real to integer.

The proposed implementation has two advantages over the existing one:

* The code is shared by both C and C++ front ends in the function
"coercion_warning" which is called through the existing function
"convert_and_check".

* The proposed implementation warns for int i = 1.1 but not for int i
= 1.0 while the previous code warns for both cases.

The patch must be applied after the ones given in
http://gcc.gnu.org/ml/gcc-patches/2006-07/msg00098.html

Bootstrapped and tested in trunk revision 115112

Comments and suggestions are very welcome.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: wcoercion-g++-real-to-integer.patch
Type: text/x-patch
Size: 2997 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc/attachments/20060709/29283f02/attachment.bin>


More information about the Gcc mailing list