[4.3] wcoercion (4): fixes for C++ front-end

Manuel López-Ibáñez lopezibanez@gmail.com
Fri Nov 17 08:29:00 GMT 2006


( 4th patch in the series from the Wcoercion Project
http://gcc.gnu.org/wiki/Wcoercion#Background )

This patch addresses some issues with the implementation of
Wconversion in the C++ front-end:

* Adds testcases for the C++ front-end. The testcases are exactly
equal to those in the C front-end.

* warns for int i = 1.1 but not for int i = 1.0 (I think this is a
better fix for PR13932).

* updates  the manual to document all warnings given for C++. (I am
not an expert in C++ so suggestions are certainly welcome).

Jason Merrill agreed to review this patch but any comments are
welcome. In particular, I am not sure what side-effects may have the
use of convert_and_check() in C++ (which uses convert internally)
since sometimes the C++ front-end uses cp_convert() and other
functions instead of convert().

Bootstrapped and tested with --enable-languages=all for trunk revision
118055 on i686-pc-linux-gnu

2006-11-17  Manuel Lopez-Ibanez <manu@gcc.gnu.org>

      * cp/call.c (convert_like_real): Use convert_and_check() instead
of custom warning.
      * cp/typeck.c (build_binary_op): Use convert_and_check() before
      * doc/invoke.texi (-Wconversion): Document warnings specific to C++.

2006-11-17  Manuel Lopez-Ibanez <manu@gcc.gnu.org>

      * g++.dg/warn/Wconversion-integer.C: New
      * g++.dg/warn/Wconversion-real.C: New.
      * g++.dg/warn/Wconversion-real-integer.C: New.
      * g++.dg/warn/conv2.C: Modified.

More information about the Gcc-patches mailing list