Mercurial > projects > ldc
diff dmd/expression.c @ 1012:39cf8fa483fd
Error gracefully for +=, -=, *=, /= if rhs is complex but lhs isn't.
author | Christian Kamm <kamm incasoftware de> |
---|---|
date | Sat, 28 Feb 2009 19:58:30 +0100 |
parents | ea82e2077f9d |
children | b30fe7e1dbb9 |
line wrap: on
line diff
--- a/dmd/expression.c Sat Feb 28 17:44:53 2009 +0100 +++ b/dmd/expression.c Sat Feb 28 19:58:30 2009 +0100 @@ -8031,6 +8031,9 @@ e2 = e2->castTo(sc, e1->type); } e = this; + + if (e2->type->iscomplex() && !type->iscomplex()) + error("Cannot assign %s to %s", e2->type->toChars(), type->toChars()); } } return e; @@ -8080,6 +8083,9 @@ e2 = e2->castTo(sc, e1->type); } e = this; + + if (e2->type->iscomplex() && !type->iscomplex()) + error("Cannot assign %s to %s", e2->type->toChars(), type->toChars()); } return e; } @@ -8201,6 +8207,9 @@ e2 = e2->castTo(sc, t2); } } + + if (e2->type->iscomplex() && !type->iscomplex()) + error("Cannot assign %s to %s", e2->type->toChars(), type->toChars()); } return this; } @@ -8267,6 +8276,10 @@ return e; } } + + if (e2->type->iscomplex() && !type->iscomplex()) + error("Cannot assign %s to %s", e2->type->toChars(), type->toChars()); + return this; }