Mercurial > projects > ldc
changeset 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 | 010b8b67de1a |
children | 8c73ff5f69e0 |
files | dmd/expression.c dmd2/expression.c |
diffstat | 2 files changed, 26 insertions(+), 0 deletions(-) [+] |
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; }
--- a/dmd2/expression.c Sat Feb 28 17:44:53 2009 +0100 +++ b/dmd2/expression.c Sat Feb 28 19:58:30 2009 +0100 @@ -8063,6 +8063,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; @@ -8112,6 +8115,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; } @@ -8233,6 +8239,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; } @@ -8299,6 +8308,10 @@ return e; } } + + if (e2->type->iscomplex() && !type->iscomplex()) + error("Cannot assign %s to %s", e2->type->toChars(), type->toChars()); + return this; }