+2009-08-05 Manuel López-Ibáñez <manu@gcc.gnu.org>
+
+ PR c++/36069
+ * typeck.c (convert_for_assignment): Do not warn for any boolean
+ variant. Use explicit location.
+
2009-08-04 Dodji Seketeli <dodji@redhat.com>
PR c++/39987
&& type == boolean_type_node
&& TREE_CODE (rhs) == MODIFY_EXPR
&& !TREE_NO_WARNING (rhs)
- && TREE_TYPE (rhs) != boolean_type_node
+ && TREE_CODE (TREE_TYPE (rhs)) != BOOLEAN_TYPE
&& (complain & tf_warning))
{
- warning (OPT_Wparentheses,
- "suggest parentheses around assignment used as truth value");
+ location_t loc = EXPR_HAS_LOCATION (rhs)
+ ? EXPR_LOCATION (rhs) : input_location;
+
+ warning_at (loc, OPT_Wparentheses,
+ "suggest parentheses around assignment used as truth value");
TREE_NO_WARNING (rhs) = 1;
}
--- /dev/null
+// PR c++/36069 Strange "warning: suggest parentheses around
+// assignment used as truth value" with volatile/non volatile bools
+// { dg-do compile }
+// { dg-options "-Wparentheses" }
+struct foo {
+ bool a;
+ volatile bool b,c;
+ foo() { a = b = c = false; } // { dg-bogus "parentheses" }
+};
+
+int main() {
+ bool a;
+ volatile bool b,c;
+ a = b = c = false; // { dg-bogus "parentheses" }
+ foo A;
+}