+1998-08-07 Mark Mitchell <mark@markmitchell.com>
+
+ * cvt.c (cp_convert_to_pointer): Handle a NULL pointer
+ conversions, even in complex virtual base class hierarchies.
+
1998-08-06 Mark Mitchell <mark@markmitchell.com>
* cp-tree.h (ENUM_TEMPLATE_INFO): New macro.
&& TREE_CODE (TREE_TYPE (type)) == RECORD_TYPE
&& IS_AGGR_TYPE (TREE_TYPE (type))
&& IS_AGGR_TYPE (TREE_TYPE (intype))
- && TREE_CODE (TREE_TYPE (intype)) == RECORD_TYPE)
+ && TREE_CODE (TREE_TYPE (intype)) == RECORD_TYPE
+ /* If EXPR is NULL, then we don't need to do any arithmetic
+ to convert it:
+
+ [conv.ptr]
+
+ The null pointer value is converted to the null pointer
+ value of the destination type. */
+ && !integer_zerop (expr))
{
enum tree_code code = PLUS_EXPR;
tree binfo = get_binfo (TREE_TYPE (type), TREE_TYPE (intype), 1);
--- /dev/null
+// Build don't link:
+
+struct S0 { };
+struct S1 : virtual public S0 { };
+struct S2 : virtual public S0 { };
+
+struct S3 : public S1, public S2, virtual public S0
+{
+};
+
+void f(const S0*) {}
+
+void g()
+{
+ f(static_cast<S3*>(0));
+}