diff dmd/ReturnStatement.d @ 73:ef02e2e203c2

Updating to dmd2.033
author korDen
date Sat, 28 Aug 2010 19:42:41 +0400
parents 2e2a5c3f943a
children 43073c7c7769
line wrap: on
line diff
--- a/dmd/ReturnStatement.d	Sat Aug 28 16:19:48 2010 +0200
+++ b/dmd/ReturnStatement.d	Sat Aug 28 19:42:41 2010 +0400
@@ -330,16 +330,22 @@
 			return gs;
 		}
 
-		if (exp && tbret.ty == TY.Tvoid && !fd.isMain())
+		if (exp && tbret.ty == Tvoid && !implicit0)
 		{
 			/* Replace:
 			 *	return exp;
 			 * with:
 			 *	exp; return;
+			 * or, if main():
+			 *	exp; return 0;
 			 */
 			Statement s = new ExpStatement(loc, exp);
+			//s = s.semantic(sc);
 			loc = Loc(0);
-			exp = null;
+			if (fd.isMain())
+				exp = new IntegerExp(0);
+			else
+				exp = null;
 			return new CompoundStatement(loc, s, this);
 		}