diff dmd/TypeDArray.d @ 135:af1bebfd96a4 dmd2037

dmd 2.038
author Eldar Insafutdinov <e.insafutdinov@gmail.com>
date Mon, 13 Sep 2010 22:19:42 +0100
parents e28b18c23469
children fa9a71a9f5a8
line wrap: on
line diff
--- a/dmd/TypeDArray.d	Sat Sep 11 13:03:39 2010 +0100
+++ b/dmd/TypeDArray.d	Mon Sep 13 22:19:42 2010 +0100
@@ -195,7 +195,7 @@
 			/* Allow conversion to void*
 			 */
 			if (tp.next.ty == Tvoid &&
-				(next.mod == tp.next.mod || tp.next.mod == MODconst))
+				MODimplicitConv(next.mod, tp.next.mod))
 			{
 				return MATCHconvert;
 			}
@@ -208,7 +208,7 @@
 			int offset = 0;
 			TypeDArray ta = cast(TypeDArray)to;
 
-			if (!(next.mod == ta.next.mod || ta.next.mod == MODconst))
+			if (!MODimplicitConv(next.mod, ta.next.mod))
 				return MATCHnomatch;	// not const-compatible
 
 			/* Allow conversion to void[]
@@ -226,6 +226,7 @@
 				return m;
 			}
 
+static if(false) {
 			/* Allow conversions of T[][] to const(T)[][]
 			 */
 			if (mod == ta.mod && next.ty == Tarray && ta.next.ty == Tarray)
@@ -234,7 +235,7 @@
 				if (m == MATCHconst)
 				return m;
 			}
-
+}
 			/* Conversion of array of derived to array of base
 			 */
 			if (ta.next.isBaseOf(next, &offset) && offset == 0)
@@ -248,9 +249,7 @@
 	version (LOGDEFAULTINIT) {
 		printf("TypeDArray.defaultInit() '%s'\n", toChars());
 	}
-		Expression e = new NullExp(loc);
-		e.type = this;
-		return e;
+		return new NullExp(loc, this);
 	}
 	
     override bool builtinTypeInfo()
@@ -258,7 +257,7 @@
 	version (DMDV2) {
 		return !mod && (next.isTypeBasic() !is null && !next.mod ||
 			// strings are so common, make them builtin
-			next.ty == Tchar && next.mod == MODinvariant);
+			next.ty == Tchar && next.mod == MODimmutable);
 	} else {
 		return next.isTypeBasic() !is null;
 	}