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

--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-11-02 
13:15:35 UTC ---
Well, we shouldn't early return error_mark_node, however.

Also, in the specific case at issue here we are still failing to warn, because
we return from build_static_cast_1 pretty early, here:

  if (result)
    {
      result = convert_from_reference (result);

      /* [expr.static.cast]

     If T is a reference type, the result is an lvalue; otherwise,
     the result is an rvalue.  */
      if (TREE_CODE (type) != REFERENCE_TYPE)
    result = rvalue (result);
      return result;
    }

looks like one more call to check_for_casting_away_constness is missing.

Reply via email to