Commit a99e5cb4 by Ian Lance Taylor Committed by Ian Lance Taylor

typeck.c (convert_for_assignment): Only warn about a = b = c when converting to bool.

cp/:
	* typeck.c (convert_for_assignment): Only warn about a = b = c
	when converting to bool.
testsuite/:
	* g++.dg/warn/Wparentheses-24.C: New test.

From-SVN: r121087
parent 38fbab2a
2007-01-23 Ian Lance Taylor <iant@google.com>
* typeck.c (convert_for_assignment): Only warn about a = b = c
when converting to bool.
2007-01-23 Roger Sayle <roger@eyesopen.com>
* call.c (null_ptr_cst_p): Replace use of TREE_CONSTANT_OVERFLOW with
......
......@@ -6380,11 +6380,13 @@ convert_for_assignment (tree type, tree rhs,
errtype);
}
/* If -Wparentheses, warn about a = b = c when a has type bool. */
/* If -Wparentheses, warn about a = b = c when a has type bool and b
does not. */
if (warn_parentheses
&& type == boolean_type_node
&& TREE_CODE (rhs) == MODIFY_EXPR
&& !TREE_NO_WARNING (rhs))
&& !TREE_NO_WARNING (rhs)
&& TREE_TYPE (rhs) != boolean_type_node)
{
warning (OPT_Wparentheses,
"suggest parentheses around assignment used as truth value");
......
2007-01-23 Ian Lance Taylor <iant@google.com>
* g++.dg/warn/Wparentheses-24.C: New test.
2007-01-23 Richard Guenther <rguenther@suse.de>
PR testsuite/30560
// { dg-do compile }
// { dg-options "-Wparentheses" }
extern int foo (int);
bool a, b, c;
bool
bar ()
{
c = a = b;
foo (0);
return a = b;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment