Commit 282a221c by Jason Merrill Committed by Jason Merrill

class.c (finish_struct_1): Convert integer_zero_node to ssizetype before passing…

class.c (finish_struct_1): Convert integer_zero_node to ssizetype before passing it to set_rtti_entry.

	* class.c (finish_struct_1): Convert integer_zero_node to
 	ssizetype before passing it to set_rtti_entry.
	* typeck2.c (initializer_constant_valid_p): Allow conversion of 0
	of any size to a pointer.

From-SVN: r21438
parent 9e393e15
1998-07-28 Jason Merrill <jason@yorick.cygnus.com>
* class.c (finish_struct_1): Convert integer_zero_node to
ssizetype before passing it to set_rtti_entry.
* typeck2.c (initializer_constant_valid_p): Allow conversion of 0
of any size to a pointer.
1998-07-27 Mark Mitchell <mark@markmitchell.com>
* cp-tree.h (TI_USES_TEMPLATE_PARMS): Remove.
......
......@@ -3994,7 +3994,8 @@ finish_struct_1 (t, warn_anon)
/* The first slot is for the rtti offset. */
pending_virtuals = tree_cons (NULL_TREE, NULL_TREE, pending_virtuals);
set_rtti_entry (pending_virtuals, integer_zero_node, t);
set_rtti_entry (pending_virtuals,
convert (ssizetype, integer_zero_node), t);
build_vtable (NULL_TREE, t);
}
else
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -485,13 +485,18 @@ initializer_constant_valid_p (value, endtype)
return initializer_constant_valid_p (TREE_OPERAND (value, 0),
endtype);
/* Likewise conversions from int to pointers. */
/* Likewise conversions from int to pointers, but also allow
conversions from 0. */
if (TREE_CODE (TREE_TYPE (value)) == POINTER_TYPE
&& TREE_CODE (TREE_TYPE (TREE_OPERAND (value, 0))) == INTEGER_TYPE
&& (TYPE_PRECISION (TREE_TYPE (value))
<= TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (value, 0)))))
return initializer_constant_valid_p (TREE_OPERAND (value, 0),
endtype);
&& TREE_CODE (TREE_TYPE (TREE_OPERAND (value, 0))) == INTEGER_TYPE)
{
if (integer_zerop (TREE_OPERAND (value, 0)))
return null_pointer_node;
else if (TYPE_PRECISION (TREE_TYPE (value))
<= TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (value, 0))))
return initializer_constant_valid_p (TREE_OPERAND (value, 0),
endtype);
}
/* Allow conversions to union types if the value inside is okay. */
if (TREE_CODE (TREE_TYPE (value)) == UNION_TYPE)
......
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