Commit a9183fef by Nathan Sidwell Committed by Nathan Sidwell

typeck.c (build_indirect_ref): Reject dereference of pointer to void.

	* typeck.c (build_indirect_ref): Reject dereference of pointer to
	void.

From-SVN: r29081
parent 8c5f3e15
1999-09-03 Nathan Sidwell <nathan@acm.org>
* typeck.c (build_indirect_ref): Reject dereference of pointer to
void.
1999-09-02 Mark Mitchell <mark@codesourcery.com>
* cp-tree.h (cp_function): Move here, from decl.c.
......
......@@ -2460,7 +2460,14 @@ build_indirect_ref (ptr, errorstring)
types. */
tree t = canonical_type_variant (TREE_TYPE (type));
if (TREE_CODE (pointer) == ADDR_EXPR
if (same_type_p (TYPE_MAIN_VARIANT (t), void_type_node))
{
/* A pointer to incomplete type (other than cv void) can be
dereferenced [expr.unary.op]/1 */
cp_error ("`%T' is not a pointer-to-object type", type);
return error_mark_node;
}
else if (TREE_CODE (pointer) == ADDR_EXPR
&& !flag_volatile
&& same_type_p (t, TREE_TYPE (TREE_OPERAND (pointer, 0))))
/* The POINTER was something like `&x'. We simplify `*&x' to
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment