Mercurial > projects > ldc
comparison dmd2/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 | 063ba84a965f |
children | 3d46f7ee466e |
comparison
equal
deleted
inserted
replaced
1011:010b8b67de1a | 1012:39cf8fa483fd |
---|---|
8061 { | 8061 { |
8062 assert(global.errors || e2->type->isfloating()); | 8062 assert(global.errors || e2->type->isfloating()); |
8063 e2 = e2->castTo(sc, e1->type); | 8063 e2 = e2->castTo(sc, e1->type); |
8064 } | 8064 } |
8065 e = this; | 8065 e = this; |
8066 | |
8067 if (e2->type->iscomplex() && !type->iscomplex()) | |
8068 error("Cannot assign %s to %s", e2->type->toChars(), type->toChars()); | |
8066 } | 8069 } |
8067 } | 8070 } |
8068 return e; | 8071 return e; |
8069 } | 8072 } |
8070 | 8073 |
8110 { | 8113 { |
8111 assert(e2->type->isfloating()); | 8114 assert(e2->type->isfloating()); |
8112 e2 = e2->castTo(sc, e1->type); | 8115 e2 = e2->castTo(sc, e1->type); |
8113 } | 8116 } |
8114 e = this; | 8117 e = this; |
8118 | |
8119 if (e2->type->iscomplex() && !type->iscomplex()) | |
8120 error("Cannot assign %s to %s", e2->type->toChars(), type->toChars()); | |
8115 } | 8121 } |
8116 return e; | 8122 return e; |
8117 } | 8123 } |
8118 | 8124 |
8119 /************************************************************/ | 8125 /************************************************************/ |
8231 assert(0); | 8237 assert(0); |
8232 } | 8238 } |
8233 e2 = e2->castTo(sc, t2); | 8239 e2 = e2->castTo(sc, t2); |
8234 } | 8240 } |
8235 } | 8241 } |
8242 | |
8243 if (e2->type->iscomplex() && !type->iscomplex()) | |
8244 error("Cannot assign %s to %s", e2->type->toChars(), type->toChars()); | |
8236 } | 8245 } |
8237 return this; | 8246 return this; |
8238 } | 8247 } |
8239 | 8248 |
8240 /************************************************************/ | 8249 /************************************************************/ |
8297 e = new AssignExp(loc, e1, e2); | 8306 e = new AssignExp(loc, e1, e2); |
8298 e->type = t1; | 8307 e->type = t1; |
8299 return e; | 8308 return e; |
8300 } | 8309 } |
8301 } | 8310 } |
8311 | |
8312 if (e2->type->iscomplex() && !type->iscomplex()) | |
8313 error("Cannot assign %s to %s", e2->type->toChars(), type->toChars()); | |
8314 | |
8302 return this; | 8315 return this; |
8303 } | 8316 } |
8304 | 8317 |
8305 /************************************************************/ | 8318 /************************************************************/ |
8306 | 8319 |