http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53524

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot       |paolo.carlini at oracle dot
                   |gnu.org                     |com

--- Comment #6 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-05-30 
10:22:33 UTC ---
The warnings are an unintended effect of my fix for PR16603.

We warn at the end of the below lines of call.c. At the moment isn't clear to
me *when* it would actually make sense to warn. Hints?

///////////////////////////////////

  /* [expr.cond]

     After those conversions, one of the following shall hold:

     --The second and third operands have the same type; the result  is  of
       that type.  */
  if (same_type_p (arg2_type, arg3_type))
    result_type = arg2_type;
  /* [expr.cond]

     --The second and third operands have arithmetic or enumeration
       type; the usual arithmetic conversions are performed to bring
       them to a common type, and the result is of that type.  */
  else if ((ARITHMETIC_TYPE_P (arg2_type)
        || UNSCOPED_ENUM_P (arg2_type))
       && (ARITHMETIC_TYPE_P (arg3_type)
           || UNSCOPED_ENUM_P (arg3_type)))
    {
      /* In this case, there is always a common type.  */
      result_type = type_after_usual_arithmetic_conversions (arg2_type,
                                 arg3_type);
      do_warn_double_promotion (result_type, arg2_type, arg3_type,
                "implicit conversion from %qT to %qT to "
                "match other result of conditional",
                input_location);

      if (TREE_CODE (arg2_type) == ENUMERAL_TYPE
      && TREE_CODE (arg3_type) == ENUMERAL_TYPE)
        {
          if (complain & tf_warning)
            warning (0, 
                     "enumeral mismatch in conditional expression: %qT vs %qT",
                     arg2_type, arg3_type);
        }

Reply via email to