changeset 1121:3d46f7ee466e

Apply [1120] to D2 as well (untested).
author Frits van Bommel <fvbommel wxs.nl>
date Sun, 15 Mar 2009 16:57:44 +0100
parents 0d38fa5a0b46
children c614ef596a20
files dmd2/expression.c
diffstat 1 files changed, 13 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/dmd2/expression.c	Sun Mar 15 15:58:38 2009 +0100
+++ b/dmd2/expression.c	Sun Mar 15 16:57:44 2009 +0100
@@ -1319,11 +1319,17 @@
 	    case Twchar:
 	    case Tuns16:	value = (d_uns16) value;	break;
 	    case Tint32:	value = (d_int32) value;	break;
-	    case Tpointer:
 	    case Tdchar:
 	    case Tuns32:	value = (d_uns32) value;	break;
 	    case Tint64:	value = (d_int64) value;	break;
 	    case Tuns64:	value = (d_uns64) value;	break;
+	    case Tpointer:
+                // FIXME: Other pointer widths than 32 and 64?
+                if (PTRSIZE == 4)
+                    value = (d_uns32) value;
+                else
+                    value = (d_uns64) value;
+                break;
 
 	    case Tenum:
 	    {
@@ -1483,6 +1489,7 @@
 		break;
 
 	    case Tuns64:
+            L4:
 		buf->printf("%lluLU", v);
 		break;
 
@@ -1495,7 +1502,11 @@
 		buf->writestring("cast(");
 		buf->writestring(t->toChars());
 		buf->writeByte(')');
-		goto L3;
+                // FIXME: Other pointer widths than 32 and 64?
+                if (PTRSIZE == 4)
+                    goto L3;
+                else
+                    goto L4;
 
 	    default:
 		/* This can happen if errors, such as