[PATCH, c++] Emit the diagnostic messages of convert_to_void
Jason Merrill
jason@redhat.com
Fri Jul 2 20:15:00 GMT 2010
> + The IMPLICIT is ICV_NULL when the user is explicitly converting an expression
> + to void via a cast.
In that case let's call it ICV_CAST.
Let's improve the error messages here, too.
> + warning (0, "object of incomplete type %qT will not "
> + "be accessed in void context", type);
"conversion to void will not access object of incomplete type %qT"
(Incidentally, I'm surprised these warnings are unconditional rather
than being controlled by a -Wvolatile option or something, but I guess
we can leave that alone for now since volatile is relatively rare.)
> + warning (0, "object of incomplete type %qT will not "
> + "be accessed in second operand of conditional",
"indirection will not access object of incomplete type %qT in second
operand of conditional expression" (or third)
"indirection will not access object of incomplete type %qT in right
operand of comma operator" (or left)
"indirection will not access object of incomplete type %qT in statement"
"indirection will not access object of incomplete type %qT in for
increment expression"
> /* Don't load the value if this is an implicit dereference, or if
> the type needs to be handled by ctors/dtors. */
> else if (is_volatile && (is_reference || TREE_ADDRESSABLE (type)))
Let's split up these cases.
is_reference:
"conversion to void will not access object of type %qT"
"implicit dereference will not access object of type %qT in..."
TREE_ADDRESSABLE:
"conversion to void will not access object of non-trivially-copyable
type %qT"
"indirection will not access object of non-trivially-copyable type %qT
in..."
> + warning (0, "object %qE of incomplete type %qT will not "
> + "be accessed in void context", expr, type);
"conversion to void will not access object %qE of incomplete type %qT"
"variable %qE of incomplete type %qT will not be accessed in..."
> + error ("void cast "
> + "cannot resolve address of overloaded function");
conversion to void, etc.
> + "second operand of conditional "
> + "is a reference, not call, to function %qE", expr);
conditional expression, etc.
> + warning (OPT_Wunused_value,
> + "second operand of conditional has no effect");
Likewise.
Jason
More information about the Gcc-patches
mailing list