diff dmd/CastExp.d @ 137:09c858522d55

merge
author Trass3r
date Mon, 13 Sep 2010 23:29:00 +0200
parents af1bebfd96a4
children e3afd1303184
line wrap: on
line diff
--- a/dmd/CastExp.d	Mon Sep 13 23:27:38 2010 +0200
+++ b/dmd/CastExp.d	Mon Sep 13 23:29:00 2010 +0200
@@ -183,6 +183,10 @@
 					// Cast away pointer to shared
 					goto Lunsafe;
 
+        	    if (t1bn.isWild() && !tobn.isConst() && !tobn.isWild())
+            		// Cast wild to anything but const | wild
+		            goto Lunsafe;
+
 				if (tobn.isTypeBasic() && tobn.size() < t1bn.size()) {
 					// Allow things like casting a long* to an int*
 					;
@@ -425,27 +429,7 @@
 			to.toCBuffer(buf, null, hgs);
 		else
 		{
-			switch (mod)
-			{   
-				case MODundefined:
-					break;
-				case MODconst:
-					buf.writestring(Token.tochars[TOKconst]);
-					break;
-				case MODinvariant:
-					buf.writestring(Token.tochars[TOKimmutable]);
-					break;
-				case MODshared:
-					buf.writestring(Token.tochars[TOKshared]);
-					break;
-				case MODshared | MODconst:
-					buf.writestring(Token.tochars[TOKshared]);
-					buf.writeByte(' ');
-					buf.writestring(Token.tochars[TOKconst]);
-					break;
-				default:
-					assert(0);
-			}
+			MODtoBuffer(buf, mod);
 		}
 	}
 		buf.writeByte(')');