comparison 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
comparison
equal deleted inserted replaced
1576:4551475bc6b6 1577:e4f7b5d9c68a
1794 Type *t1 = e1->type->toBasetype(); 1794 Type *t1 = e1->type->toBasetype();
1795 Type *t2 = e2->type->toBasetype(); 1795 Type *t2 = e2->type->toBasetype();
1796 1796
1797 if (op == TOKmin || op == TOKadd) 1797 if (op == TOKmin || op == TOKadd)
1798 { 1798 {
1799 if (t1 == t2 && (t1->ty == Tstruct || t1->ty == Tclass)) 1799 if (t1->ty == Tstruct)
1800 goto Lerror; 1800 {
1801 if (t2->ty == Tstruct &&
1802 ((TypeStruct *)t1)->sym == ((TypeStruct *)t2)->sym)
1803 goto Lerror;
1804 }
1805 else if (t1->ty == Tclass)
1806 {
1807 if (t2->ty == Tclass)
1808 goto Lerror;
1809 }
1801 } 1810 }
1802 1811
1803 if (!typeMerge(sc, this, &type, &e1, &e2)) 1812 if (!typeMerge(sc, this, &type, &e1, &e2))
1804 goto Lerror; 1813 goto Lerror;
1805 return this; 1814 return this;
1939 1948
1940 IntRange ir; 1949 IntRange ir;
1941 IntRange ir1 = e1->getIntRange(); 1950 IntRange ir1 = e1->getIntRange();
1942 IntRange ir2 = e2->getIntRange(); 1951 IntRange ir2 = e2->getIntRange();
1943 1952
1953 if (ir2.imax == 0 || ir2.imin == 0)
1954 return Expression::getIntRange();
1955
1944 ir.imin = ir1.imin / ir2.imax; 1956 ir.imin = ir1.imin / ir2.imax;
1945 ir.imax = ir1.imax / ir2.imin; 1957 ir.imax = ir1.imax / ir2.imin;
1946 1958
1947 ir.imin &= type->sizemask(); 1959 ir.imin &= type->sizemask();
1948 ir.imax &= type->sizemask(); 1960 ir.imax &= type->sizemask();