Mercurial > projects > ddmd
diff dmd/CmpExp.d @ 79:43073c7c7769
updated to 2.035
also implemented a few missing functions
still crashes in Import.importAll though
author | Trass3r |
---|---|
date | Mon, 30 Aug 2010 03:57:51 +0200 |
parents | 2e2a5c3f943a |
children | e28b18c23469 |
line wrap: on
line diff
--- a/dmd/CmpExp.d Sun Aug 29 14:39:08 2010 +0100 +++ b/dmd/CmpExp.d Mon Aug 30 03:57:51 2010 +0200 @@ -38,8 +38,6 @@ override Expression semantic(Scope sc) { Expression e; - Type t1; - Type t2; version (LOGSEMANTIC) { printf("CmpExp.semantic('%s')\n", toChars()); @@ -49,8 +47,10 @@ BinExp.semanticp(sc); - if (e1.type.toBasetype().ty == Tclass && e2.op == TOKnull || - e2.type.toBasetype().ty == Tclass && e1.op == TOKnull) + Type t1 = e1.type.toBasetype(); + Type t2 = e2.type.toBasetype(); + if (t1.ty == Tclass && e2.op == TOKnull || + t2.ty == Tclass && e1.op == TOKnull) { error("do not use null when comparing class types"); } @@ -71,6 +71,14 @@ return e; } + // Disallow comparing T[]==T and T==T[] + if (e1.op == TOKslice && t1.ty == Tarray && e2.implicitConvTo(t1.nextOf()) || + e2.op == TOKslice && t2.ty == Tarray && e1.implicitConvTo(t2.nextOf())) + { + incompatibleTypes(); + return new ErrorExp(); + } + typeCombine(sc); type = Type.tboolean;