summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@yorick.cygnus.com>1997-12-15 07:24:29 +0000
committerJason Merrill <jason@gcc.gnu.org>1997-12-15 02:24:29 -0500
commit5c0ad6720402b0919e837ea1552be82b32c1eebe (patch)
tree03592c4cfb777f6578fc5f57fc525f2370c5e85c
parent6d8ccdbbb20cdff710cd6977165bde1d763f6a40 (diff)
downloadgcc-5c0ad6720402b0919e837ea1552be82b32c1eebe.tar.gz
cvt.c (cp_convert_to_pointer): Fix base conversion of pm's.
* cvt.c (cp_convert_to_pointer): Fix base conversion of pm's. * pt.c (type_unification_real): Change __null to type void* with a warning. From-SVN: r17098
-rw-r--r--gcc/cp/ChangeLog7
-rw-r--r--gcc/cp/cvt.c12
-rw-r--r--gcc/cp/pt.c6
3 files changed, 23 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index ef5907892f0..0a628dacdda 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,10 @@
+Sun Dec 14 22:34:20 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * cvt.c (cp_convert_to_pointer): Fix base conversion of pm's.
+
+ * pt.c (type_unification_real): Change __null to type void* with
+ a warning.
+
Sun Dec 14 20:38:35 1997 Mark Mitchell <mmitchell@usa.net>
* call.c (implicit_conversion): Don't call
diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c
index 29964928005..fdfdb7f2790 100644
--- a/gcc/cp/cvt.c
+++ b/gcc/cp/cvt.c
@@ -258,11 +258,19 @@ cp_convert_to_pointer (type, expr)
{
tree b1 = TYPE_OFFSET_BASETYPE (TREE_TYPE (type));
tree b2 = TYPE_OFFSET_BASETYPE (TREE_TYPE (intype));
- tree binfo = get_binfo (b1, b2, 1);
+ tree binfo = get_binfo (b2, b1, 1);
+ enum tree_code code = PLUS_EXPR;
+
if (binfo == NULL_TREE)
- binfo = get_binfo (b2, b1, 1);
+ {
+ binfo = get_binfo (b1, b2, 1);
+ code = MINUS_EXPR;
+ }
+
if (binfo == error_mark_node)
return error_mark_node;
+ if (binfo && ! TREE_VIA_VIRTUAL (binfo))
+ expr = size_binop (code, expr, BINFO_OFFSET (binfo));
}
if (TREE_CODE (TREE_TYPE (intype)) == METHOD_TYPE
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index e3bfb34356b..8dff4c1a01b 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -3722,6 +3722,12 @@ type_unification_real (tparms, targs, parms, args, nsubsts, subr,
arg = TREE_TYPE (arg);
}
#endif
+ if (! flag_ansi && arg == TREE_TYPE (null_node))
+ {
+ warning ("using type void* for NULL");
+ arg = ptr_type_node;
+ }
+
if (! subr && TREE_CODE (arg) == REFERENCE_TYPE)
arg = TREE_TYPE (arg);