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
This commit is contained in:
Nathan Sidwell 1999-09-03 09:01:14 +00:00 committed by Nathan Sidwell
parent 8c5f3e15b0
commit a9183fef29
2 changed files with 13 additions and 1 deletions

View file

@ -1,3 +1,8 @@
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.

View file

@ -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