diff dmd2/cast.c @ 1577:e4f7b5d9c68a

DMD 2.032 Merge.
author Robert Clipsham <robert@octarineparrot.com>
date Tue, 08 Sep 2009 10:07:56 +0100
parents 54b3c1394d62
children
line wrap: on
line diff
--- a/dmd2/cast.c	Tue Aug 25 21:35:43 2009 +0200
+++ b/dmd2/cast.c	Tue Sep 08 10:07:56 2009 +0100
@@ -1796,8 +1796,17 @@
 
     if (op == TOKmin || op == TOKadd)
     {
-	if (t1 == t2 && (t1->ty == Tstruct || t1->ty == Tclass))
-	    goto Lerror;
+	if (t1->ty == Tstruct)
+	{
+	    if (t2->ty == Tstruct &&
+		((TypeStruct *)t1)->sym == ((TypeStruct *)t2)->sym)
+		goto Lerror;
+	}
+	else if (t1->ty == Tclass)
+	{
+	    if (t2->ty == Tclass)
+		goto Lerror;
+	}
     }
 
     if (!typeMerge(sc, this, &type, &e1, &e2))
@@ -1941,6 +1950,9 @@
     IntRange ir1 = e1->getIntRange();
     IntRange ir2 = e2->getIntRange();
 
+    if (ir2.imax == 0 || ir2.imin == 0)
+	return Expression::getIntRange();
+
     ir.imin = ir1.imin / ir2.imax;
     ir.imax = ir1.imax / ir2.imin;