diff dmd/CastExp.d @ 130:60bb0fe4563e

dmdfe 2.037 first main iteration
author Eldar Insafutdinov <e.insafutdinov@gmail.com>
date Thu, 09 Sep 2010 22:51:44 +0100
parents 010eb8f0e18d
children af1bebfd96a4
line wrap: on
line diff
--- a/dmd/CastExp.d	Sun Sep 05 15:32:22 2010 +0400
+++ b/dmd/CastExp.d	Thu Sep 09 22:51:44 2010 +0100
@@ -153,14 +153,18 @@
 			to = Type.terror;
 		}
 
-		if (global.params.safe && !sc.module_.safe && !sc.intypeof)
+//static if (true) {
+		if (sc.func && sc.func.isSafe() && !sc.intypeof)
+//} else {
+//		if (global.params.safe && !sc.module_.safe && !sc.intypeof)
+//}
 		{	// Disallow unsafe casts
 			Type tob = to.toBasetype();
 			Type t1b = e1.type.toBasetype();
 			if (!t1b.isMutable() && tob.isMutable())
 			{   // Cast not mutable to mutable
 			  Lunsafe:
-				error("cast from %s to %s not allowed in safe mode", e1.type.toChars(), to.toChars());
+				error("cast from %s to %s not allowed in safe code", e1.type.toChars(), to.toChars());
 			}
 			else if (t1b.isShared() && !tob.isShared())
 				// Cast away shared
@@ -459,7 +463,7 @@
 			Expression.buildArrayIdent(buf, arguments);
 	}
 
-	override Expression buildArrayLoop(Arguments fparams)
+	override Expression buildArrayLoop(Parameters fparams)
 	{
 		Type tb = type.toBasetype();
 		if (tb.ty == Tarray || tb.ty == Tsarray)