On 09/16/2016 05:01 AM, Marek Polacek wrote:
@@ -5853,7 +5853,16 @@ cp_build_unary_op (enum tree_code code, tree xarg, bool 
noconvert,
                                                   arg, true)))
        errstring = _("wrong type argument to bit-complement");
       else if (!noconvert && CP_INTEGRAL_TYPE_P (TREE_TYPE (arg)))
-       arg = cp_perform_integral_promotions (arg, complain);
+       {
+         /* Warn if the expression has boolean value.  */
+         location_t location = EXPR_LOC_OR_LOC (arg, input_location);

Let's move this variable to the beginning of the function; hopefully it will become a parameter soon.

+         if ((TREE_CODE (TREE_TYPE (arg)) == BOOLEAN_TYPE
+              || truth_value_p (TREE_CODE (arg)))

You shouldn't need to check truth_value_p; in C++ all truth operations have type bool.

+             && warning_at (location, OPT_Wbool_operation,
+                            "%<~%> on a boolean expression"))

And let's refer to "expression of type bool" rather than "boolean expression".

Jason

Reply via email to