+2016-10-07 Bernd Edlinger <bernd.edlinger@hotmail.de>
+
+ PR c++/77700
+ * c-common.c (c_common_truthvalue_conversion): Warn also for
+ suspicious enum values in boolean context.
+
2016-10-06 Jakub Jelinek <jakub@redhat.com>
Implement P0258R2 - helper for C++17
return expr;
case INTEGER_CST:
+ if (TREE_CODE (TREE_TYPE (expr)) == ENUMERAL_TYPE
+ && !integer_zerop (expr)
+ && !integer_onep (expr))
+ warning_at (location, OPT_Wint_in_bool_context,
+ "enum constant in boolean context");
return integer_zerop (expr) ? truthvalue_false_node
: truthvalue_true_node;
+2016-10-07 Bernd Edlinger <bernd.edlinger@hotmail.de>
+
+ PR c++/77700
+ * parser.c (cp_parser_base_specifier): Fix a warning.
+
2016-10-07 Bernd Schmidt <bschmidt@redhat.com>
PR c++/69733
cp_parser_nested_name_specifier_opt (parser,
/*typename_keyword_p=*/true,
/*check_dependency_p=*/true,
- typename_type,
+ /*type_p=*/true,
/*is_declaration=*/true);
/* If the base class is given by a qualified name, assume that names
we see are type names or templates, as appropriate. */
+2016-10-07 Bernd Edlinger <bernd.edlinger@hotmail.de>
+
+ PR c++/77700
+ * c-c++-common/Wint-in-bool-context.c: Update test.
+
2016-10-07 Richard Biener <rguenther@suse.de>
* gcc.dg/tree-ssa/vrp01.c: Adjust.
/* { dg-options "-Wint-in-bool-context" } */
/* { dg-do compile } */
+enum truth { yes, no, maybe };
+
int foo (int a, int b)
{
if (a > 0 && a <= (b == 1) ? 1 : 2) /* { dg-warning "boolean context" } */
for (a = 0; 1 << a; a++); /* { dg-warning "boolean context" } */
+ if (yes || no || maybe) /* { dg-warning "boolean context" "" { target c++ } } */
+ return 8;
+
+ if (yes || no) /* { dg-bogus "boolean context" } */
+ return 9;
+
return 0;
}