[C++ Patch] PR 53158
Paolo Carlini
paolo.carlini@oracle.com
Mon May 7 18:36:00 GMT 2012
On 05/07/2012 08:23 PM, Paolo Carlini wrote:
> Index: typeck.c
> ===================================================================
> --- typeck.c (revision 187249)
> +++ typeck.c (working copy)
> @@ -4782,7 +4782,11 @@ cp_truthvalue_conversion (tree expr)
> return ret;
> }
> else
> - return c_common_truthvalue_conversion (input_location, expr);
> + {
> + if (TREE_CODE (expr) == CALL_EXPR)
> + return condition_conversion (expr);
> + return c_common_truthvalue_conversion (input_location, expr);
> + }
> }
>
> /* Just like cp_truthvalue_conversion, but we want a
> CLEANUP_POINT_EXPR. */
Well, not exactly like this because it recurses forever when the code is
fine ;) but I think you get the idea, we don't want to unconditionally
use c_common_truthvalue_conversion and we want to stop *before* trying
to synthesize a NE_EXPR.
About the error message proper, the locations are currently pretty wrong
for these code paths - is always too advanced, at the end of the
expression, I'm afraid fixing that will require touching quite a few
lines of code.
Paolo.
More information about the Gcc-patches
mailing list