changeset 84:be2ab491772e

Expressions -> Vector!Expression
author Eldar Insafutdinov <e.insafutdinov@gmail.com>
date Mon, 30 Aug 2010 16:12:19 +0100
parents ee670dd808a8
children 8e69d041a99d
files dmd/AddrExp.d dmd/AggregateDeclaration.d dmd/AnonDeclaration.d dmd/Array.d dmd/ArrayExp.d dmd/ArrayInitializer.d dmd/ArrayLiteralExp.d dmd/ArrayTypes.d dmd/AssignExp.d dmd/AssocArrayLiteralExp.d dmd/BinExp.d dmd/CallExp.d dmd/Cast.d dmd/ClassDeclaration.d dmd/DotIdExp.d dmd/DotVarExp.d dmd/Expression.d dmd/ForeachStatement.d dmd/FuncDeclaration.d dmd/InlineCostState.d dmd/InlineDoState.d dmd/InlineScanState.d dmd/NewExp.d dmd/Parser.d dmd/PragmaDeclaration.d dmd/PragmaStatement.d dmd/SliceExp.d dmd/StructDeclaration.d dmd/StructInitializer.d dmd/StructLiteralExp.d dmd/TemplateInstance.d dmd/TraitsExp.d dmd/TupleExp.d dmd/TypeAArray.d dmd/TypeArray.d dmd/TypeClass.d dmd/TypeStruct.d dmd/VarDeclaration.d dmd/codegen/Util.d dmd/expression/Cat.d dmd/expression/Equal.d dmd/expression/Slice.d dmd/expression/Util.d dmd/interpret/Util.d
diffstat 44 files changed, 275 insertions(+), 289 deletions(-) [+]
line wrap: on
line diff
--- a/dmd/AddrExp.d	Mon Aug 30 18:42:04 2010 +0400
+++ b/dmd/AddrExp.d	Mon Aug 30 16:12:19 2010 +0100
@@ -162,9 +162,9 @@
 			{   
 				OverExp eo = cast(OverExp)e1;
 				FuncDeclaration f = null;
-				foreach(Dsymbol s; eo.vars.a)
+				foreach (s; eo.vars.a)
 				{   
-					FuncDeclaration f2 = s.isFuncDeclaration();
+					auto f2 = s.isFuncDeclaration();
 					assert(f2);
 					if (f2.overloadExactMatch(t.nextOf()))
 					{   
@@ -220,9 +220,9 @@
 			{   
 				OverExp eo = cast(OverExp)e1;
 				FuncDeclaration f = null;
-				foreach(Dsymbol s; eo.vars.a)
+				foreach (s; eo.vars.a)
 				{   
-					FuncDeclaration f2 = s.isFuncDeclaration();
+					auto f2 = s.isFuncDeclaration();
 					assert(f2);
 					if (f2.overloadExactMatch(t.nextOf()))
 					{   
--- a/dmd/AggregateDeclaration.d	Mon Aug 30 18:42:04 2010 +0400
+++ b/dmd/AggregateDeclaration.d	Mon Aug 30 16:12:19 2010 +0100
@@ -150,7 +150,7 @@
     uint alignsize;		// size of struct for alignment purposes
     uint structalign;	// struct member alignment in effect
     int hasUnions;		// set if aggregate has overlapping fields
-    Dsymbols fields;	// VarDeclaration fields
+    VarDeclarations fields;	// VarDeclaration fields
     uint sizeok;		// set when structsize contains valid data
 				// 0: no size
 				// 1: size is correct
@@ -184,7 +184,7 @@
 		super(id);
 		this.loc = loc;
 		
-		fields = new Dsymbols();	///
+		fields = new VarDeclarations();	///
 		dtors = new FuncDeclarations();
 	}
 
@@ -346,9 +346,8 @@
 
 version (DMDV2)
 {
-		foreach (Dsymbol s; fields)
+		foreach (size_t i, VarDeclaration v; fields)
 		{
-			VarDeclaration v = s.isVarDeclaration();
 			assert(v && v.storage_class & STC.STCfield);
 			if (v.storage_class & STC.STCref)
 				continue;
--- a/dmd/AnonDeclaration.d	Mon Aug 30 18:42:04 2010 +0400
+++ b/dmd/AnonDeclaration.d	Mon Aug 30 16:12:19 2010 +0100
@@ -134,7 +134,7 @@
 			//printf("\tadding members of aad to '%s'\n", ad.toChars());
 			for (uint i = 0; i < aad.fields.dim; i++)
 			{
-				VarDeclaration v = cast(VarDeclaration)aad.fields[i];
+				auto v = aad.fields[i];
 
 				v.offset += sc.offset;
 				ad.fields.push(v);
--- a/dmd/Array.d	Mon Aug 30 18:42:04 2010 +0400
+++ b/dmd/Array.d	Mon Aug 30 16:12:19 2010 +0100
@@ -189,6 +189,11 @@
         return _dim;
     }
 
+    @property final void dim(size_t newDim)
+    {
+        _dim = newDim;
+    }
+	
     @property final size_t length() const
     {
         return _dim;
@@ -199,18 +204,18 @@
         return _dim;
     }    
 */
-/*    
+
     @property T *data()
     {
         return _data;
     }
-*/    
+
     @property final size_t allocdim()
     {
         return _allocdim;
     }
     
-    T opIndex(size_t index)
+    ref T opIndex(size_t index)
     {
         return _data[index];
     }
@@ -223,7 +228,7 @@
     final T pop()
     {        
         T v = _data[--_dim];
-        _data[dim] = T.init;
+//        _data[dim] = T.init;
         return v;
     }
     
@@ -270,6 +275,7 @@
 		}
 
 		_dim = newdim;
+        // TODO if newdim < dim set memory to T.init
 	}
     
     int opApply(scope int delegate(ref T) dg)
@@ -302,6 +308,21 @@
 		insert(dim, a);
 	}
     
+    final void remove(size_t i)
+	{
+		memmove(_data + i, _data + i + 1, (_dim - i) * T.sizeof);
+//		_data[dim-1] = T.init;
+        _dim--;
+	}
+
+    final void insert(uint index, T ptr)
+	{
+		reserve(1);
+		memmove(_data + index + 1, _data + index, (_dim - index) * T.sizeof);
+		_data[index] = ptr;
+		_dim++;
+	}
+    
     final void insert(size_t index, Vector!T a)
 	{
 		if (a !is null) {
--- a/dmd/ArrayExp.d	Mon Aug 30 18:42:04 2010 +0400
+++ b/dmd/ArrayExp.d	Mon Aug 30 16:12:19 2010 +0100
@@ -56,14 +56,12 @@
 		}
 
 		// Run semantic() on each argument
-		for (size_t i = 0; i < arguments.dim; i++)
+		foreach (size_t i, Expression e; arguments)
 		{	
-			e = cast(Expression)arguments.data[i];
-
 			e = e.semantic(sc);
 			if (!e.type)
 				error("%s has no value", e.toChars());
-			arguments.data[i] = cast(void*)e;
+			arguments[i] = e;
 		}
 
 		expandTuples(arguments);
--- a/dmd/ArrayInitializer.d	Mon Aug 30 18:42:04 2010 +0400
+++ b/dmd/ArrayInitializer.d	Mon Aug 30 16:12:19 2010 +0100
@@ -51,10 +51,10 @@
 		ai.value.setDim(value.dim);
 		for (int i = 0; i < ai.value.dim; i++)
 		{	
-			Expression e = cast(Expression)index.data[i];
+			Expression e = index[i];
 			if (e)
 				e = e.syntaxCopy();
-			ai.index.data[i] = cast(void*)e;
+			ai.index[i] = e;
 
 			Initializer init = cast(Initializer)value.data[i];
 			init = init.syntaxCopy();
@@ -65,7 +65,7 @@
 	
     void addInit(Expression index, Initializer value)
 	{
-		this.index.push(cast(void*)index);
+		this.index.push(index);
 		this.value.push(cast(void*)value);
 		dim = 0;
 		type = null;
@@ -73,7 +73,6 @@
 	
     override Initializer semantic(Scope sc, Type t)
 	{
-		uint i;
 		uint length;
 
 		//printf("ArrayInitializer.semantic(%s)\n", t.toChars());
@@ -96,17 +95,15 @@
 		}
 
 		length = 0;
-		for (i = 0; i < index.dim; i++)
+		foreach (size_t i, Expression idx; index)
 		{	
-			Expression idx;
 			Initializer val;
 
-			idx = cast(Expression)index.data[i];
 			if (idx)
 			{   
 				idx = idx.semantic(sc);
 				idx = idx.optimize(WANTvalue | WANTinterpret);
-				index.data[i] = cast(void*)idx;
+				index[i] = idx;
 				length = cast(uint)idx.toInteger();
 			}
 
@@ -231,7 +228,7 @@
 			{
 				goto Lno;
 			}
-			elements.data[j] = cast(void*)ex;
+			elements[j] = ex;
 		}
 
 		/* Fill in any missing elements with the default initializer
@@ -246,7 +243,7 @@
 						goto Lno;
 					if (!init)
 						init = (cast(TypeNext)t).next.defaultInit(Loc(0));
-					elements.data[i] = cast(void*)init;
+					elements[i] = init;
 				}
 			}
 
--- a/dmd/ArrayLiteralExp.d	Mon Aug 30 18:42:04 2010 +0400
+++ b/dmd/ArrayLiteralExp.d	Mon Aug 30 16:12:19 2010 +0100
@@ -15,6 +15,7 @@
 import dmd.HdrGenState;
 import dmd.backend.dt_t;
 import dmd.InlineScanState;
+import dmd.Array;
 import dmd.ArrayTypes;
 import dmd.TOK;
 import dmd.IntegerExp;
@@ -45,7 +46,7 @@
 	{
 		super(loc, TOK.TOKarrayliteral, ArrayLiteralExp.sizeof);
 		elements = new Expressions();
-		elements.push(cast(void*)e);
+		elements.push(e);
 	}
 
 	override Expression syntaxCopy()
@@ -67,10 +68,10 @@
 		// Run semantic() on each element
 		for (int i = 0; i < elements.dim; i++)
 		{	
-			e = cast(Expression)elements.data[i];
+			e = elements.data[i];
 			e = e.semantic(sc);
 			assert(e.type);
-			elements.data[i] = cast(void*)e;
+			elements[i] = e;
 		}
 
 		expandTuples(elements);
@@ -106,7 +107,7 @@
 				StringExp se = cast(StringExp)e;
 				se.committed = 0;
 			}
-			elements.data[i] = cast(void*)e;
+			elements.data[i] = e;
 		}
 
 		if (!t0)
@@ -130,14 +131,14 @@
 		//printf("ArrayLiteralExp.toElem() %s\n", toChars());
 		if (elements)
 		{
-			scope Expressions args = new Expressions();
+			scope args = new Array(); // ddmd was Expressions
 			dim = elements.dim;
 			args.setDim(dim + 1);		// +1 for number of args parameter
 			e = el_long(TYint, dim);
 			args.data[dim] = cast(void*)e;
 			for (size_t i = 0; i < dim; i++)
 			{   
-				Expression el = cast(Expression)elements.data[i];
+				auto el = elements[i];
 				elem* ep = el.toElem(irs);
 
 				if (tybasic(ep.Ety) == TYstruct || tybasic(ep.Ety) == TYarray)
@@ -230,12 +231,9 @@
 	{
 		if (elements)
 		{
-			for (size_t i = 0; i < elements.dim; i++)
+			foreach (ref Expression e; elements)
 			{   
-				Expression e = cast(Expression)elements.data[i];
-
 				e = e.optimize(WANTvalue | (result & WANTinterpret));
-				elements.data[i] = cast(void*)e;
 			}
 		}
 
@@ -306,12 +304,10 @@
 			}
 
 			e = cast(ArrayLiteralExp)copy();
-			e.elements = cast(Expressions)elements.copy();
-			for (int i = 0; i < elements.dim; i++)
+			e.elements = elements.copy();
+			foreach (size_t i, Expression ex; elements)
 			{   
-				Expression ex = cast(Expression)elements.data[i];
-				ex = ex.castTo(sc, tb.nextOf());
-				e.elements.data[i] = cast(void*)ex;
+				e.elements[i] = ex.castTo(sc, tb.nextOf());
 			}
 			e.type = t;
 			return e;
--- a/dmd/ArrayTypes.d	Mon Aug 30 18:42:04 2010 +0400
+++ b/dmd/ArrayTypes.d	Mon Aug 30 16:12:19 2010 +0100
@@ -4,8 +4,6 @@
 
 class TemplateParameters : Array { final typeof(this) copy() { auto a = new typeof(this); copyTo(a); return a; } }
 
-class Expressions : Array { final typeof(this) copy() { auto a = new typeof(this); copyTo(a); return a; } }
-
 class Statements : Array { final typeof(this) copy() { auto a = new typeof(this); copyTo(a); return a; } }
 
 class BaseClasses : Array { final typeof(this) copy() { auto a = new typeof(this); copyTo(a); return a; } }
--- a/dmd/AssignExp.d	Mon Aug 30 18:42:04 2010 +0400
+++ b/dmd/AssignExp.d	Mon Aug 30 16:12:19 2010 +0100
@@ -107,9 +107,9 @@
 				if (search_function(ad, Id.indexass))
 				{	
 					Expression e = new DotIdExp(loc, ae.e1, Id.indexass);
-					Expressions a = cast(Expressions)ae.arguments.copy();
+					auto a = ae.arguments.copy();
 
-					a.insert(0, cast(void*)e2);
+					a.insert(0, e2);
 					e = new CallExp(loc, e, a);
 					e = e.semantic(sc);
 					return e;
@@ -160,12 +160,12 @@
 					Expression e = new DotIdExp(loc, ae.e1, Id.sliceass);
 					Expressions a = new Expressions();
 
-					a.push(cast(void*)e2);
+					a.push(e2);
 					if (ae.lwr)
 					{   
-						a.push(cast(void*)ae.lwr);
+						a.push(ae.lwr);
 						assert(ae.upr);
-						a.push(cast(void*)ae.upr);
+						a.push(ae.upr);
 					}
 					else
 						assert(!ae.upr);
@@ -203,14 +203,14 @@
 			}
 			else
 			{   
-				Expressions exps = new Expressions;
+				auto exps = new Expressions;
 				exps.setDim(dim);
 
 				for (int i = 0; i < dim; i++)
 				{	
-					Expression ex1 = cast(Expression)tup1.exps.data[i];
-					Expression ex2 = cast(Expression)tup2.exps.data[i];
-					exps.data[i] = cast(void*) new AssignExp(loc, ex1, ex2);
+					auto ex1 = tup1.exps[i];
+					auto ex2 = tup2.exps[i];
+					exps[i] = new AssignExp(loc, ex1, ex2);
 				}
 				Expression e = new TupleExp(loc, exps);
 				e = e.semantic(sc);
--- a/dmd/AssocArrayLiteralExp.d	Mon Aug 30 18:42:04 2010 +0400
+++ b/dmd/AssocArrayLiteralExp.d	Mon Aug 30 16:12:19 2010 +0100
@@ -65,8 +65,8 @@
 			key = key.semantic(sc);
 			value = value.semantic(sc);
 
-			keys.data[i] = cast(void *)key;
-			values.data[i] = cast(void *)value;
+			keys.data[i] = key;
+			values.data[i] = value;
 		}
 		expandTuples(keys);
 		expandTuples(values);
@@ -91,13 +91,13 @@
 				tkey = key.type;
 			else
 				key = key.implicitCastTo(sc, tkey);
-			keys.data[i] = cast(void *)key;
+			keys.data[i] = key;
 
 			if (!tvalue)
 				tvalue = value.type;
 			else
 				value = value.implicitCastTo(sc, tvalue);
-			values.data[i] = cast(void *)value;
+			values.data[i] = value;
 		}
 
 		if (!tkey)
@@ -228,11 +228,11 @@
 			Expression e = cast(Expression)keys.data[i];
 
 			e = e.optimize(WANTvalue | (result & WANTinterpret));
-			keys.data[i] = cast(void*)e;
+			keys.data[i] = e;
 
 			e = cast(Expression)values.data[i];
 			e = e.optimize(WANTvalue | (result & WANTinterpret));
-			values.data[i] = cast(void*)e;
+			values.data[i] = e;
 		}
 		return this;
 	}
@@ -261,7 +261,7 @@
 			{
 				if (keysx == keys)
 					keysx = cast(Expressions)keys.copy();
-				keysx.data[i] = cast(void*)ex;
+				keysx.data[i] = ex;
 			}
 
 			ex = evalue.interpret(istate);
@@ -273,8 +273,8 @@
 			if (ex != evalue)
 			{
 				if (valuesx == values)
-				valuesx = cast(Expressions)values.copy();
-				valuesx.data[i] = cast(void*)ex;
+				valuesx = values.copy();
+				valuesx.data[i] = ex;
 			}
 		}
 		
@@ -375,11 +375,11 @@
 			{   
 				Expression ex = cast(Expression)values.data[i];
 				ex = ex.castTo(sc, tb.nextOf());
-				e.values.data[i] = cast(void*)ex;
+				e.values.data[i] = ex;
 
 				ex = cast(Expression)keys.data[i];
 				ex = ex.castTo(sc, (cast(TypeAArray)tb).index);
-				e.keys.data[i] = cast(void*)ex;
+				e.keys.data[i] = ex;
 			}
 			e.type = t;
 			return e;
--- a/dmd/BinExp.d	Mon Aug 30 18:42:04 2010 +0400
+++ b/dmd/BinExp.d	Mon Aug 30 16:12:19 2010 +0100
@@ -857,7 +857,7 @@
 
 			/* Create new struct literal reflecting updated fieldi
 			 */
-			Expressions expsx = changeOneElement(se.elements, fieldi, cast(void*)e2);
+			auto expsx = changeOneElement(se.elements, fieldi, e2);
 			v.value = new StructLiteralExp(se.loc, se.sd, expsx);
 			v.value.type = se.type;
 
@@ -905,7 +905,7 @@
 
 			/* Create new struct literal reflecting updated fieldi
 			 */
-			Expressions expsx = changeOneElement(se.elements, fieldi, cast(void*)e2);
+			auto expsx = changeOneElement(se.elements, fieldi, e2);
 			v.value = new StructLiteralExp(se.loc, se.sd, expsx);
 			v.value.type = se.type;
 
@@ -1011,7 +1011,7 @@
 				/* Create new array literal reflecting updated elem
 				 */
 				int elemi = cast(int)index.toInteger();
-				Expressions expsx = changeOneElement(ae.elements, elemi, cast(void*)e2);
+				auto expsx = changeOneElement(ae.elements, elemi, e2);
 				v.value = new ArrayLiteralExp(ae.loc, expsx);
 				v.value.type = ae.type;
 			}
@@ -1026,24 +1026,24 @@
 				for (size_t j = valuesx.dim; j; )
 				{	
 					j--;
-					Expression ekey = cast(Expression)aae.keys.data[j];
+					Expression ekey = aae.keys[j];
 					Expression ex = Equal(TOKequal, Type.tbool, ekey, index);
 					if (ex is EXP_CANT_INTERPRET)
 						return EXP_CANT_INTERPRET;
 					if (ex.isBool(true))
 					{   
-						valuesx.data[j] = cast(void*)e2;
+						valuesx[j] = e2;
 						updated = 1;
 					}
 					else
-						valuesx.data[j] = aae.values.data[j];
+						valuesx[j] = aae.values[j];
 				}
 				if (!updated)
 				{	
 					// Append index/e2 to keysx[]/valuesx[]
-					valuesx.push(cast(void*)e2);
-					keysx = cast(Expressions)keysx.copy();
-					keysx.push(cast(void*)index);
+					valuesx.push(e2);
+					keysx = keysx.copy();
+					keysx.push(index);
 				}
 				v.value = new AssocArrayLiteralExp(aae.loc, keysx, valuesx);
 				v.value.type = aae.type;
@@ -1164,11 +1164,11 @@
 				return e2;
 
 			// Create new struct literal reflecting updated field
-			Expressions expsx = changeOneElement(se.elements, fieldi, cast(void*)e2);
+			auto expsx = changeOneElement(se.elements, fieldi, e2);
 			Expression newstruct = new StructLiteralExp(se.loc, se.sd, expsx);
 
 			// Create new array literal reflecting updated struct elem
-			ae.elements = changeOneElement(ae.elements, elemi, cast(void*)newstruct);
+			ae.elements = changeOneElement(ae.elements, elemi, newstruct);
 			return ae;
 		}
 		/* Slice assignment, initialization of static arrays
@@ -1733,9 +1733,9 @@
 			FuncDeclaration lastf;
 
 			args1.setDim(1);
-			args1.data[0] = cast(void*) e1;
+			args1[0] = e1;
 			args2.setDim(1);
-			args2.data[0] = cast(void*) e2;
+			args2[0] = e2;
 			argsset = 1;
 
 			///memset(&m, 0, sizeof(m));
@@ -1823,9 +1823,9 @@
 				if (!argsset)
 				{	
 					args1.setDim(1);
-					args1.data[0] = cast(void*) e1;
+					args1[0] = e1;
 					args2.setDim(1);
-					args2.data[0] = cast(void*) e2;
+					args2[0] = e2;
 				}
 
 				///memset(&m, 0, sizeof(m));
--- a/dmd/CallExp.d	Mon Aug 30 18:42:04 2010 +0400
+++ b/dmd/CallExp.d	Mon Aug 30 16:12:19 2010 +0100
@@ -93,11 +93,11 @@
 	{
 		super(loc, TOK.TOKcall, CallExp.sizeof, e);
 		
-		Expressions arguments = new Expressions();
+		auto arguments = new Expressions();
 	    if (earg1)
 		{	
 			arguments.setDim(1);
-			arguments.data[0] = cast(void*)earg1;
+			arguments[0] = earg1;
 		}
 		this.arguments = arguments;
 	}
@@ -106,10 +106,10 @@
 	{
 		super(loc, TOK.TOKcall, CallExp.sizeof, e);
 		
-		Expressions arguments = new Expressions();
+		auto arguments = new Expressions();
 		arguments.setDim(2);
-		arguments.data[0] = cast(void*)earg1;
-		arguments.data[1] = cast(void*)earg2;
+		arguments.data[0] = earg1;
+		arguments.data[1] = earg2;
 
 		this.arguments = arguments;
 	}
@@ -188,7 +188,7 @@
 				{
 					if (!arguments)
 						arguments = new Expressions();
-					arguments.shift(cast(void*)dotid.e1);
+					arguments.shift(dotid.e1);
 version (DMDV2) {
 					e1 = new DotIdExp(dotid.loc, new IdentifierExp(dotid.loc, Id.empty), dotid.ident);
 } else {
@@ -784,12 +784,9 @@
 		// Optimize parameters
 		if (arguments)
 		{
-			for (size_t i = 0; i < arguments.dim; i++)
+			foreach (ref Expression ee; arguments)
 			{   
-				Expression ee = cast(Expression)arguments.data[i];
-
 				ee = ee.optimize(WANT.WANTvalue);
-				arguments.data[i] = cast(void*)ee;
 			}
 		}
 
@@ -862,11 +859,11 @@
 					args.setDim(arguments.dim);
 					for (size_t i = 0; i < args.dim; i++)
 					{
-						Expression earg = cast(Expression)arguments.data[i];
+						auto earg = arguments[i];
 						earg = earg.interpret(istate);
 						if (earg == EXP_CANT_INTERPRET)
 							return earg;
-						args.data[i] = cast(void*)earg;
+						args[i] = earg;
 					}
 					e = eval_builtin(b, args);
 					if (!e)
--- a/dmd/Cast.d	Mon Aug 30 18:42:04 2010 +0400
+++ b/dmd/Cast.d	Mon Aug 30 16:12:19 2010 +0100
@@ -128,7 +128,7 @@
 			exp = Cast(v.type, v.type, exp);
 			if (exp is EXP_CANT_INTERPRET)
 				return exp;
-			elements.push(cast(void*)exp);
+			elements.push(exp);
 		}
 		e = new StructLiteralExp(loc, sd, elements);
 		e.type = type;
--- a/dmd/ClassDeclaration.d	Mon Aug 30 18:42:04 2010 +0400
+++ b/dmd/ClassDeclaration.d	Mon Aug 30 16:12:19 2010 +0100
@@ -581,7 +581,7 @@
 		{
 		interfaceSemantic(sc);
 
-		foreach(Dsymbol s; members)
+		foreach (s; members)
 			s.addMember(sc, this, true);
 
 		/* If this is a nested class, add the hidden 'this'
@@ -692,7 +692,7 @@
 		Scope scsave = sc;	/// a copy must be created?
 		int members_dim = members.dim;
 		sizeok = 0;
-		foreach(Dsymbol s; members)
+		foreach (s; members)
 			s.semantic(sc);
 
 		if (sizeok == 2)
@@ -827,7 +827,7 @@
 			buf.writenl();
 			buf.writeByte('{');
 			buf.writenl();
-			foreach(Dsymbol s; members)
+			foreach (s; members)
 			{
 				buf.writestring("    ");
 				s.toCBuffer(buf, hgs);
@@ -947,9 +947,9 @@
 		OverloadSet os = s.isOverloadSet();	
 		if (os)
 		{
-			foreach(Dsymbol s2; os.a)
+			foreach (s2; os.a)
 			{   
-				FuncDeclaration f2 = s2.isFuncDeclaration();
+				auto f2 = s2.isFuncDeclaration();
 				if (f2 && overloadApply(f2, &p.isf, &p))
 					return false;
 			}
@@ -1203,7 +1203,7 @@
 			scclass = SCcomdat;
 
 		// Put out the members
-		foreach(Dsymbol member; members)
+		foreach (member; members)
 			member.toObjFile(0);
 
 static if (false) {
@@ -1391,7 +1391,7 @@
 		{
 			if (cd.members)
 			{
-				foreach(Dsymbol sm; cd.members)
+				foreach (sm; cd.members)
 				{
 					//printf("sm = %s %s\n", sm.kind(), sm.toChars());
 					if (sm.hasPointers())
--- a/dmd/DotIdExp.d	Mon Aug 30 18:42:04 2010 +0400
+++ b/dmd/DotIdExp.d	Mon Aug 30 16:12:19 2010 +0100
@@ -149,7 +149,7 @@
 				Expression ee = cast(Expression)te.exps.data[i];
 				ee = ee.semantic(sc);
 				ee = new DotIdExp(e.loc, ee, Id.offsetof);
-				exps.data[i] = cast(void*)ee;
+				exps.data[i] = ee;
 			}
 			e = new TupleExp(loc, exps);
 			e = e.semantic(sc);
--- a/dmd/DotVarExp.d	Mon Aug 30 18:42:04 2010 +0400
+++ b/dmd/DotVarExp.d	Mon Aug 30 16:12:19 2010 +0100
@@ -80,9 +80,9 @@
 							error("%s is not a member", e.toChars());
 						else
 						{	
-							DsymbolExp ve = cast(DsymbolExp)e;
+							auto ve = cast(DsymbolExp)e;
 							e = new DotVarExp(loc, e1, ve.s.isDeclaration());
-							exps.push(cast(void*)e);
+							exps.push(e);
 						}
 					} else {
 						error("%s is not an expression", o.toString());
--- a/dmd/Expression.d	Mon Aug 30 18:42:04 2010 +0400
+++ b/dmd/Expression.d	Mon Aug 30 16:12:19 2010 +0100
@@ -7,6 +7,7 @@
 import dmd.Type;
 import dmd.WANT;
 import dmd.Scope;
+import dmd.Array;
 import dmd.ArrayTypes;
 import dmd.OutBuffer;
 import dmd.HdrGenState;
@@ -310,12 +311,12 @@
 		{
 			a = new Expressions();
 			a.setDim(exps.dim);
-			for (int i = 0; i < a.dim; i++)
+			for (size_t i = 0; i < a.dim; i++)
 			{   
-				Expression e = cast(Expression)exps.data[i];
+				auto e = exps[i];
 
 				e = e.syntaxCopy();
-				a.data[i] = cast(void*)e;
+				a[i] = e;
 			}
 		}
 		return a;
@@ -944,7 +945,7 @@
     void buildArrayIdent(OutBuffer buf, Expressions arguments)
 	{
 		buf.writestring("Exp");
-		arguments.shift(cast(void*)this);
+		arguments.shift(this);
 	}
     
     Expression buildArrayLoop(Arguments fparams)
@@ -967,3 +968,5 @@
 		assert(false);
 	}
 }
+
+alias Vector!Expression Expressions;
\ No newline at end of file
--- a/dmd/ForeachStatement.d	Mon Aug 30 18:42:04 2010 +0400
+++ b/dmd/ForeachStatement.d	Mon Aug 30 16:12:19 2010 +0100
@@ -624,12 +624,12 @@
 						fdapply = FuncDeclaration.genCfunc(Type.tindex, "_aaApply");
 
 					ec = new VarExp(Loc(0), fdapply);
-					Expressions exps = new Expressions();
-					exps.push(cast(void*)aggr);
+					auto exps = new Expressions();
+					exps.push(aggr);
 					size_t keysize = cast(uint)taa.index.size();
 					keysize = (keysize + (PTRSIZE-1)) & ~(PTRSIZE-1);
-					exps.push(cast(void*)new IntegerExp(Loc(0), keysize, Type.tsize_t));
-					exps.push(cast(void*)flde);
+					exps.push(new IntegerExp(Loc(0), keysize, Type.tsize_t));
+					exps.push(flde);
 					e = new CallExp(loc, ec, exps);
 					e.type = Type.tindex;	// don't run semantic() on e
 				}
@@ -664,11 +664,11 @@
 					fdapply = FuncDeclaration.genCfunc(Type.tindex, fdname[0..j].idup);
 
 					ec = new VarExp(Loc(0), fdapply);
-					Expressions exps = new Expressions();
+					auto exps = new Expressions();
 					if (tab.ty == TY.Tsarray)
 					   aggr = aggr.castTo(sc, tn.arrayOf());
-					exps.push(cast(void*)aggr);
-					exps.push(cast(void*)flde);
+					exps.push(aggr);
+					exps.push(flde);
 					e = new CallExp(loc, ec, exps);
 					e.type = Type.tindex;	// don't run semantic() on e
 				}
@@ -677,8 +677,8 @@
 					/* Call:
 					 *	aggr(flde)
 					 */
-					Expressions exps = new Expressions();
-					exps.push(cast(void*)flde);
+					auto exps = new Expressions();
+					exps.push(flde);
 					e = new CallExp(loc, aggr, exps);
 					e = e.semantic(sc);
 					if (e.type != Type.tint32)
@@ -714,7 +714,7 @@
 					}
 } else {
 					ec = new DotIdExp(loc, aggr, idapply);
-					exps.push(cast(void*)flde);
+					exps.push(flde);
 }
 					e = new CallExp(loc, ec, exps);
 					e = e.semantic(sc);
--- a/dmd/FuncDeclaration.d	Mon Aug 30 18:42:04 2010 +0400
+++ b/dmd/FuncDeclaration.d	Mon Aug 30 16:12:19 2010 +0100
@@ -1929,7 +1929,7 @@
 			else
 				e = p.type.defaultInit(Loc(0));
 
-			args.data[u] = cast(void*)e;
+			args[u] = e;
 		}
 
 		MATCH m = cast(MATCH) tg.callMatch(null, args);
@@ -2393,15 +2393,15 @@
 						return null;
 					}
 				}
-				eargs.data[i] = cast(void*)earg;
+				eargs[i] = earg;
 			}
 
 			for (size_t i = 0; i < dim; i++)
 			{   
-				Expression earg = cast(Expression)eargs.data[i];
+				auto earg = eargs[i];
 				Argument arg = Argument.getNth(tf.parameters, i);
 				auto v = cast(VarDeclaration)parameters[i];
-				vsave.data[i] = cast(void*)v.value;
+				vsave[i] = v.value;
 version (LOG) {
 				printf("arg[%d] = %s\n", i, earg.toChars());
 }
@@ -2492,7 +2492,7 @@
 				if (auto v = cast(VarDeclaration)s3)
 				{
 					//printf("\tsaving [%d] %s = %s\n", i, v.toChars(), v.value ? v.value.toChars() : "");
-					valueSaves.data[i] = cast(void*)v.value;
+					valueSaves[i] = v.value;
 					v.value = null;
 				}
 			}
@@ -2698,7 +2698,7 @@
 		return 0;
 	}
 
-    Expression doInline(InlineScanState* iss, Expression ethis, Array arguments)
+    Expression doInline(InlineScanState* iss, Expression ethis, Expressions arguments)
 	{
 		InlineDoState ids = new InlineDoState();
 		DeclarationExp de;
@@ -3754,4 +3754,4 @@
     override FuncDeclaration isFuncDeclaration() { return this; }
 }
 
-class FuncDeclarations : Vector!FuncDeclaration { final typeof(this) copy() { auto a = new typeof(this); copyTo(a); return a; } }
\ No newline at end of file
+alias Vector!FuncDeclaration FuncDeclarations;
\ No newline at end of file
--- a/dmd/InlineCostState.d	Mon Aug 30 18:42:04 2010 +0400
+++ b/dmd/InlineCostState.d	Mon Aug 30 16:12:19 2010 +0100
@@ -1,7 +1,6 @@
 module dmd.InlineCostState;
 
 import dmd.FuncDeclaration;
-import dmd.Array;
 import dmd.Expression;
 
 struct InlineCostState
@@ -14,15 +13,14 @@
 
 const int COST_MAX = 250;
 
-int arrayInlineCost(InlineCostState* ics, Array arguments)
+int arrayInlineCost(InlineCostState* ics, Expressions arguments)
 {
 	int cost = 0;
 
     if (arguments)
     {
-		for (int i = 0; i < arguments.dim; i++)
+		foreach (e; arguments)
 		{   
-			Expression e = cast(Expression)arguments.data[i];
 			if (e)
 				cost += e.inlineCost(ics);
 		}
--- a/dmd/InlineDoState.d	Mon Aug 30 18:42:04 2010 +0400
+++ b/dmd/InlineDoState.d	Mon Aug 30 16:12:19 2010 +0100
@@ -40,7 +40,7 @@
 			if (e)
 			{
 				e = e.doInline(ids);
-				newa.data[i] = cast(void*)e;
+				newa[i] = e;
 			}
 		}
     }
--- a/dmd/InlineScanState.d	Mon Aug 30 18:42:04 2010 +0400
+++ b/dmd/InlineScanState.d	Mon Aug 30 16:12:19 2010 +0100
@@ -79,18 +79,15 @@
     }
 }
 
-void arrayInlineScan(InlineScanState* iss, Array arguments)
+void arrayInlineScan(InlineScanState* iss, Expressions arguments)
 {
     if (arguments)
     {
-		for (int i = 0; i < arguments.dim; i++)
+		foreach (ref Expression e; arguments)
 		{   
-			Expression e = cast(Expression)arguments.data[i];
-
 			if (e)
 			{
 				e = e.inlineScan(iss);
-				arguments.data[i] = cast(void*)e;
 			}
 		}
     }
--- a/dmd/NewExp.d	Mon Aug 30 18:42:04 2010 +0400
+++ b/dmd/NewExp.d	Mon Aug 30 16:12:19 2010 +0100
@@ -261,7 +261,7 @@
 				Expression e = new IntegerExp(loc, cd.size(loc), Type.tsize_t);
 				if (!newargs)
 					newargs = new Expressions();
-				newargs.shift(cast(void*)e);
+				newargs.shift(e);
 
 				f = cd.aggNew.overloadResolve(loc, null, newargs);
 				allocator = f.isNewDeclaration();
@@ -312,7 +312,7 @@
 				Expression e = new IntegerExp(loc, sd.size(loc), Type.tuns32);
 				if (!newargs)
 					newargs = new Expressions();
-				newargs.shift(cast(void*)e);
+				newargs.shift(e);
 
 				f = sd.aggNew.overloadResolve(loc, null, newargs);
 				allocator = f.isNewDeclaration();
@@ -353,7 +353,7 @@
 				arg = arg.optimize(WANTvalue);
 				if (arg.op == TOKint64 && cast(long)arg.toInteger() < 0)
 					error("negative array index %s", arg.toChars());
-				arguments.data[j] = cast(void*) arg;
+				arguments[j] =  arg;
 				tb = (cast(TypeDArray)tb).next.toBasetype();
 			}
 		}
@@ -389,7 +389,7 @@
 				Expression e = cast(Expression)newargs.data[i];
 
 				e = e.optimize(WANTvalue);
-				newargs.data[i] = cast(void*)e;
+				newargs[i] = e;
 			}
 		}
 
@@ -400,7 +400,7 @@
 				Expression e = cast(Expression)arguments.data[i];
 
 				e = e.optimize(WANTvalue);
-				arguments.data[i] = cast(void*)e;
+				arguments[i] = e;
 			}
 		}
 		return this;
--- a/dmd/Parser.d	Mon Aug 30 18:42:04 2010 +0400
+++ b/dmd/Parser.d	Mon Aug 30 16:12:19 2010 +0100
@@ -5272,7 +5272,7 @@
 					nextToken();
 					if (!keys)
 						keys = new Expressions();
-					keys.push(cast(void*)e2);
+					keys.push(e2);
 					e2 = parseAssignExp();
 				}
 				else if (keys)
@@ -5281,7 +5281,7 @@
 					delete keys;
 					keys = null;
 				}
-				values.push(cast(void*)e2);
+				values.push(e2);
 				if (token.value == TOK.TOKrbracket)
 					break;
 				check(TOK.TOKcomma);
@@ -5671,8 +5671,8 @@
 				}
 				else
 				{	// array[index, i2, i3, i4, ...]
-				Expressions arguments = new Expressions();
-				arguments.push(cast(void*)index);
+				auto arguments = new Expressions();
+				arguments.push(index);
 				if (token.value == TOK.TOKcomma)
 				{
 					nextToken();
@@ -5680,7 +5680,7 @@
 					{   Expression arg;
 
 					arg = parseAssignExp();
-					arguments.push(cast(void*)arg);
+					arguments.push(arg);
 					if (token.value == TOK.TOKrbracket)
 						break;
 					check(TOK.TOKcomma);
@@ -6023,7 +6023,7 @@
 				while (1)
 				{
 					arg = parseAssignExp();
-					arguments.push(cast(void*)arg);
+					arguments.push(arg);
 					if (token.value == endtok)
 						break;
 					check(TOK.TOKcomma);
@@ -6094,7 +6094,7 @@
 			if (e2)
 			{   
 				arguments = new Expressions();
-				arguments.push(cast(void*)e2);
+				arguments.push(e2);
 				t = new TypeDArray(taa.next);
 			}
 			else
@@ -6109,7 +6109,7 @@
 			Expression ee = tsa.dim;
 
 			arguments = new Expressions();
-			arguments.push(cast(void*)ee);
+			arguments.push(ee);
 			t = new TypeDArray(tsa.next);
 		}
 		else if (token.value == TOKlparen)
--- a/dmd/PragmaDeclaration.d	Mon Aug 30 18:42:04 2010 +0400
+++ b/dmd/PragmaDeclaration.d	Mon Aug 30 16:12:19 2010 +0100
@@ -77,11 +77,11 @@
 				error("string expected for library name");
 			else
 			{
-				Expression e = cast(Expression)args.data[0];
+				auto e = args[0];
 
 				e = e.semantic(sc);
 				e = e.optimize(WANTvalue | WANTinterpret);
-				args.data[0] = cast(void*)e;
+				args[0] = e;
 				if (e.op != TOKstring)
 					error("string expected for library name, not '%s'", e.toChars());
 				else if (global.params.verbose)
@@ -134,10 +134,10 @@
 				error("function name expected for start address");
 			else
 			{
-				Expression e = cast(Expression)args.data[0];
+				auto e = args[0];
 				e = e.semantic(sc);
 				e = e.optimize(WANTvalue | WANTinterpret);
-				args.data[0] = cast(void*)e;
+				args[0] = e;
 				Dsymbol sa = getDsymbol(e);
 				if (!sa || !sa.isFuncDeclaration())
 					error("function name expected for start address, not '%s'", e.toChars());
--- a/dmd/PragmaStatement.d	Mon Aug 30 18:42:04 2010 +0400
+++ b/dmd/PragmaStatement.d	Mon Aug 30 16:12:19 2010 +0100
@@ -2,7 +2,7 @@
 
 import dmd.Statement;
 import dmd.Identifier;
-import dmd.ArrayTypes;
+import dmd.Expression;
 import dmd.Loc;
 import dmd.Identifier;
 import dmd.Scope;
--- a/dmd/SliceExp.d	Mon Aug 30 18:42:04 2010 +0400
+++ b/dmd/SliceExp.d	Mon Aug 30 16:12:19 2010 +0100
@@ -211,12 +211,12 @@
 
 				if (e1.op == TOKtuple)
 				{	
-					Expressions exps = new Expressions;
+					auto exps = new Expressions;
 					exps.setDim(j2 - j1);
 					for (size_t i = 0; i < j2 - j1; i++)
 					{   
-						Expression e2 = cast(Expression)te.exps.data[j1 + i];
-						exps.data[i] = cast(void*)e2;
+						auto e2 = te.exps[j1 + i];
+						exps[i] = e2;
 					}
 					e = new TupleExp(loc, exps);
 				}
@@ -505,7 +505,7 @@
 	override void buildArrayIdent(OutBuffer buf, Expressions arguments)
 	{
 		buf.writestring("Slice");
-		arguments.shift(cast(void*)this);
+		arguments.shift(this);
 	}
 
 	override Expression buildArrayLoop(Arguments fparams)
@@ -516,7 +516,7 @@
 		Expression e = new IdentifierExp(Loc(0), id);
 		Expressions arguments = new Expressions();
 		Expression index = new IdentifierExp(Loc(0), Id.p);
-		arguments.push(cast(void*)index);
+		arguments.push(index);
 		e = new ArrayExp(Loc(0), e, arguments);
 		return e;
 	}
--- a/dmd/StructDeclaration.d	Mon Aug 30 18:42:04 2010 +0400
+++ b/dmd/StructDeclaration.d	Mon Aug 30 16:12:19 2010 +0100
@@ -263,8 +263,8 @@
 					FuncDeclaration fdptr = new FuncDeclaration(loc, loc, fdx.ident, STC.STCundefined, tfeqptr);
 					Expression e = new IdentifierExp(loc, Id.p);
 					e = new PtrExp(loc, e);
-					Expressions args = new Expressions();
-					args.push(cast(void*)e);
+					auto args = new Expressions();
+					args.push(e);
 					e = new IdentifierExp(loc, id);
 					e = new CallExp(loc, e, args);
 					fdptr.fbody = new ReturnStatement(loc, e);
--- a/dmd/StructInitializer.d	Mon Aug 30 18:42:04 2010 +0400
+++ b/dmd/StructInitializer.d	Mon Aug 30 16:12:19 2010 +0100
@@ -202,7 +202,7 @@
 			Expression ex = iz.toExpression();
 			if (!ex)
 				goto Lno;
-			elements.push(cast(void*)ex);
+			elements.push(ex);
 		}
 		e = new StructLiteralExp(loc, sd, elements);
 		e.type = sd.type;
--- a/dmd/StructLiteralExp.d	Mon Aug 30 18:42:04 2010 +0400
+++ b/dmd/StructLiteralExp.d	Mon Aug 30 16:12:19 2010 +0100
@@ -76,19 +76,17 @@
 			return this;
 
 		// Run semantic() on each element
-		for (size_t i = 0; i < elements.dim; i++)
+		foreach(size_t i, Expression e; elements)
 		{	
-			e = cast(Expression)elements.data[i];
 			if (!e)
 				continue;
 			e = e.semantic(sc);
-			elements.data[i] = cast(void*)e;
+			elements[i] = e;
 		}
 		expandTuples(elements);
 		size_t offset = 0;
-		for (size_t i = 0; i < elements.dim; i++)
+		foreach(size_t i, Expression e; elements)
 		{	
-			e = cast(Expression)elements.data[i];
 			if (!e)
 				continue;
 
@@ -100,7 +98,7 @@
 				error("more initializers than fields of %s", sd.toChars());
 				return new ErrorExp();
 			}
-			Dsymbol s = sd.fields[i];
+			auto s = sd.fields[i];
 			VarDeclaration v = s.isVarDeclaration();
 			assert(v);
 			if (v.offset < offset)
@@ -118,15 +116,14 @@
 
 			e = e.implicitCastTo(sc, telem);
 
-			elements.data[i] = cast(void*)e;
+			elements[i] = e;
 		}
 
 		/* Fill out remainder of elements[] with default initializers for fields[]
 		 */
 		for (size_t i = elements.dim; i < nfields; i++)
 		{	
-			Dsymbol s = sd.fields[i];
-			VarDeclaration v = s.isVarDeclaration();
+			VarDeclaration v = sd.fields[i];
 			assert(v);
 			assert(!v.isThisDeclaration());
 
@@ -150,7 +147,7 @@
 				}
 				offset = v.offset + cast(uint)v.type.size();
 			}
-			elements.push(cast(void*)e);
+			elements.push(e);
 		}
 
 		type = sd.type;
@@ -241,9 +238,8 @@
 			 * can spill over into the fields.
 			 */
 			size_t offset = 0;
-			foreach (Dsymbol s; sd.fields)
+			foreach (VarDeclaration v; sd.fields)
 			{
-				VarDeclaration v = s.isVarDeclaration();
 				assert(v);
 
 				e = el_combine(e, fillHole(stmp, &offset, v.offset, sd.structsize));
@@ -258,14 +254,12 @@
 		{
 			dim = elements.dim;
 			assert(dim <= sd.fields.dim);
-			for (size_t i = 0; i < dim; i++)
+			foreach (size_t i, Expression el; elements)
 			{   
-				Expression el = cast(Expression)elements.data[i];
 				if (!el)
 					continue;
 
-				Dsymbol s = sd.fields[i];
-				VarDeclaration v = s.isVarDeclaration();
+				VarDeclaration v = sd.fields[i];
 				assert(v);
 				assert(!v.isThisDeclaration());
 
@@ -359,8 +353,8 @@
 		if (sd.isnested)
 		{	// Initialize the hidden 'this' pointer
 			assert(sd.fields.dim);
-			Dsymbol s = sd.fields[sd.fields.dim - 1];
-			ThisDeclaration v = s.isThisDeclaration();
+			auto s = sd.fields[sd.fields.dim - 1];
+			auto v = s.isThisDeclaration();
 			assert(v);
 
 			elem* e1;
@@ -437,13 +431,12 @@
 	{
 		if (elements)
 		{
-			for (size_t i = 0; i < elements.dim; i++)
+			foreach (size_t i, Expression e; elements)
 			{   
-				Expression e = cast(Expression)elements.data[i];
 				if (!e)
 					continue;
 				e = e.optimize(WANTvalue | (result & WANTinterpret));
-				elements.data[i] = cast(void*)e;
+				elements[i] = e;
 			}
 		}
 		return this;
@@ -492,9 +485,8 @@
 		if (type.ty == t.ty && type.ty == Tstruct && (cast(TypeStruct)type).sym == (cast(TypeStruct)t).sym)
 		{
 			m = MATCHconst;
-			for (int i = 0; i < elements.dim; i++)
+			foreach(e; elements)
 			{   
-				Expression e = cast(Expression)elements.data[i];
 				Type te = e.type;
 				if (t.mod == 0)
 					te = te.mutableOf();
--- a/dmd/TemplateInstance.d	Mon Aug 30 18:42:04 2010 +0400
+++ b/dmd/TemplateInstance.d	Mon Aug 30 16:12:19 2010 +0100
@@ -919,7 +919,7 @@
 					{   
 						tiargs.reserve(dim);
 						for (size_t i = 0; i < dim; i++)
-						tiargs.insert(j + i, te.exps.data[i]);
+						tiargs.insert(j + i, cast(void*)te.exps.data[i]);
 					}
 					j--;
 				}
--- a/dmd/TraitsExp.d	Mon Aug 30 18:42:04 2010 +0400
+++ b/dmd/TraitsExp.d	Mon Aug 30 16:12:19 2010 +0100
@@ -56,7 +56,7 @@
 			}
 			else
 				e = new DsymbolExp(Loc(0), f);
-			p.exps.push(cast(void*)e);
+			p.exps.push(e);
 		}
 		return 0;
 	}
@@ -314,8 +314,8 @@
 								goto Lnext;
 						}
 
-						StringExp se = new StringExp(loc, str);
-						exps.push(cast(void*)se);
+						auto se = new StringExp(loc, str);
+						exps.push(se);
 					}
 Lnext:
 					;
--- a/dmd/TupleExp.d	Mon Aug 30 18:42:04 2010 +0400
+++ b/dmd/TupleExp.d	Mon Aug 30 16:12:19 2010 +0100
@@ -94,17 +94,17 @@
 			if (auto e = cast(Expression)o)
 			{
 				e = e.syntaxCopy();
-				exps.push(cast(void*)e);
+				exps.push(e);
 			}
 			else if (auto s = cast(Dsymbol)o)
 			{
-				Expression e = new DsymbolExp(loc, s);
-				exps.push(cast(void*)e);
+				auto e = new DsymbolExp(loc, s);
+				exps.push(e);
 			}
 			else if (auto t = cast(Type)o)
 			{
-				Expression e = new TypeExp(loc, t);
-				exps.push(cast(void*)e);
+				auto e = new TypeExp(loc, t);
+				exps.push(e);
 			}
 			else
 			{
@@ -158,7 +158,7 @@
 			{   error("%s has no value", e.toChars());
 				e.type = Type.terror;
 			}
-			exps.data[i] = cast(void *)e;
+			exps[i] = e;
 		}
 
 		expandTuples(exps);
@@ -213,7 +213,7 @@
 			Expression e = cast(Expression)exps.data[i];
 
 			e = e.optimize(WANTvalue | (result & WANTinterpret));
-			exps.data[i] = cast(void*)e;
+			exps[i] = e;
 		}
 		return this;
 	}
--- a/dmd/TypeAArray.d	Mon Aug 30 18:42:04 2010 +0400
+++ b/dmd/TypeAArray.d	Mon Aug 30 16:12:19 2010 +0100
@@ -210,7 +210,7 @@
 			fd = FuncDeclaration.genCfunc(Type.tsize_t, Id.aaLen);
 			ec = new VarExp(Loc(0), fd);
 			arguments = new Expressions();
-			arguments.push(cast(void*)e);
+			arguments.push(e);
 			e = new CallExp(e.loc, ec, arguments);
 			e.type = (cast(TypeFunction)fd.type).next;
 		}
@@ -225,8 +225,8 @@
 			fd = FuncDeclaration.genCfunc(Type.tindex, Id.aaKeys);
 			ec = new VarExp(Loc(0), fd);
 			arguments = new Expressions();
-			arguments.push(cast(void*)e);
-			arguments.push(cast(void*)new IntegerExp(Loc(0), size, Type.tsize_t));
+			arguments.push(e);
+			arguments.push(new IntegerExp(Loc(0), size, Type.tsize_t));
 			e = new CallExp(e.loc, ec, arguments);
 			e.type = index.arrayOf();
 		}
@@ -239,11 +239,11 @@
 			fd = FuncDeclaration.genCfunc(Type.tindex, Id.aaValues);
 			ec = new VarExp(Loc(0), fd);
 			arguments = new Expressions();
-			arguments.push(cast(void*)e);
+			arguments.push(e);
 			size_t keysize = cast(size_t)index.size(e.loc);
 			keysize = (keysize + PTRSIZE - 1) & ~(PTRSIZE - 1);
-			arguments.push(cast(void*)new IntegerExp(Loc(0), keysize, Type.tsize_t));
-			arguments.push(cast(void*)new IntegerExp(Loc(0), next.size(e.loc), Type.tsize_t));
+			arguments.push(new IntegerExp(Loc(0), keysize, Type.tsize_t));
+			arguments.push(new IntegerExp(Loc(0), next.size(e.loc), Type.tsize_t));
 			e = new CallExp(e.loc, ec, arguments);
 			e.type = next.arrayOf();
 		}
@@ -256,8 +256,8 @@
 			fd = FuncDeclaration.genCfunc(Type.tint64, Id.aaRehash);
 			ec = new VarExp(Loc(0), fd);
 			arguments = new Expressions();
-			arguments.push(cast(void*)e.addressOf(sc));
-			arguments.push(cast(void*)index.getInternalTypeInfo(sc));
+			arguments.push(e.addressOf(sc));
+			arguments.push(index.getInternalTypeInfo(sc));
 			e = new CallExp(e.loc, ec, arguments);
 			e.type = this;
 		}
--- a/dmd/TypeArray.d	Mon Aug 30 18:42:04 2010 +0400
+++ b/dmd/TypeArray.d	Mon Aug 30 16:12:19 2010 +0100
@@ -49,7 +49,7 @@
 			ec = new VarExp(Loc(0), fd);
 			e = e.castTo(sc, n.arrayOf());	// convert to dynamic array
 			arguments = new Expressions();
-			arguments.push(cast(void*)e);
+			arguments.push(e);
 			e = new CallExp(e.loc, ec, arguments);
 			e.type = next.arrayOf();
 		}
@@ -66,7 +66,7 @@
 			ec = new VarExp(Loc(0), fd);
 			e = e.castTo(sc, n.arrayOf());	// convert to dynamic array
 			arguments = new Expressions();
-			arguments.push(cast(void*)e);
+			arguments.push(e);
 			e = new CallExp(e.loc, ec, arguments);
 			e.type = next.arrayOf();
 		}
@@ -85,10 +85,10 @@
 			e = e.castTo(sc, n.arrayOf());	// convert to dynamic array
 			arguments = new Expressions();
 			if (dup)
-				arguments.push(cast(void*)getTypeInfo(sc));
-			arguments.push(cast(void*)e);
+				arguments.push(getTypeInfo(sc));
+			arguments.push(e);
 			if (!dup)
-				arguments.push(cast(void*)new IntegerExp(Loc(0), size, Type.tsize_t));
+				arguments.push(new IntegerExp(Loc(0), size, Type.tsize_t));
 			e = new CallExp(e.loc, ec, arguments);
 			if (ident == Id.idup)
 			{   
@@ -110,10 +110,10 @@
 			ec = new VarExp(Loc(0), fd);
 			e = e.castTo(sc, n.arrayOf());	// convert to dynamic array
 			arguments = new Expressions();
-			arguments.push(cast(void*)e);
+			arguments.push(e);
 			arguments.push(n.ty == Tsarray
-					? cast(void*)n.getTypeInfo(sc)	// don't convert to dynamic array
-					: cast(void*)n.getInternalTypeInfo(sc));
+					? n.getTypeInfo(sc)	// don't convert to dynamic array
+					: n.getInternalTypeInfo(sc));
 			e = new CallExp(e.loc, ec, arguments);
 			e.type = next.arrayOf();
 		}
--- a/dmd/TypeClass.d	Mon Aug 30 18:42:04 2010 +0400
+++ b/dmd/TypeClass.d	Mon Aug 30 16:12:19 2010 +0100
@@ -164,7 +164,7 @@
 			{   
 				VarDeclaration v2 = cast(VarDeclaration)sym.fields[i];
 				Expression fe = new DotVarExp(e.loc, e, v2);
-				exps.push(cast(void*)fe);
+				exps.push(fe);
 			}
 			e = new TupleExp(e.loc, exps);
 			sc = sc.push();
--- a/dmd/TypeStruct.d	Mon Aug 30 18:42:04 2010 +0400
+++ b/dmd/TypeStruct.d	Mon Aug 30 16:12:19 2010 +0100
@@ -181,13 +181,13 @@
 			 * (e.field0, e.field1, e.field2, ...)
 			 */
 			e = e.semantic(sc);	// do this before turning on noaccesscheck
-			Expressions exps = new Expressions;
+			auto exps = new Expressions;
 			exps.reserve(sym.fields.dim);
 			for (size_t i = 0; i < sym.fields.dim; i++)
 			{   
 				VarDeclaration v2 = cast(VarDeclaration)sym.fields[i];
 				Expression fe = new DotVarExp(e.loc, e, v2);
-				exps.push(cast(void*)fe);
+				exps.push(fe);
 			}
 			e = new TupleExp(e.loc, exps);
 			sc = sc.push();
--- a/dmd/VarDeclaration.d	Mon Aug 30 18:42:04 2010 +0400
+++ b/dmd/VarDeclaration.d	Mon Aug 30 16:12:19 2010 +0100
@@ -1,5 +1,6 @@
 module dmd.VarDeclaration;
 
+import dmd.Array;
 import dmd.Declaration;
 import dmd.SliceExp;
 import dmd.ClassDeclaration;
@@ -861,7 +862,7 @@
 					Expression ea = new SymOffExp(loc, this, 0, 0);
 					ea = new CastExp(loc, ea, Type.tvoid.pointerTo());
 					Expressions args = new Expressions();
-					args.push(cast(void*)ea);
+					args.push(ea);
 
 					Expression et = type.getTypeInfo(sc);
 					et = new DotIdExp(loc, et, Id.destroy);
@@ -964,7 +965,7 @@
 				if (loc.filename)
 					fdthis.getLevel(loc, fdv);
 
-				foreach(FuncDeclaration f; nestedrefs)
+				foreach (f; nestedrefs)
 				{	
 					if (f == fdthis)
 						goto L1;
@@ -972,7 +973,7 @@
 				nestedrefs.push(fdthis);
 			  L1: ;
 
-				foreach(s; fdv.closureVars)
+				foreach (s; fdv.closureVars)
 				{	
 					if (s == this)
 						goto L2;
@@ -1248,3 +1249,5 @@
     // Eliminate need for dynamic_cast
     override VarDeclaration isVarDeclaration() { return this; }
 }
+
+alias Vector!VarDeclaration VarDeclarations;
\ No newline at end of file
--- a/dmd/codegen/Util.d	Mon Aug 30 18:42:04 2010 +0400
+++ b/dmd/codegen/Util.d	Mon Aug 30 16:12:19 2010 +0100
@@ -73,7 +73,7 @@
 	FuncDeclaration fd,	// if !=null, this is the function being called
 	Type t,		// TypeDelegate or TypeFunction for this function
 	elem* ehidden,		// if !=null, this is the 'hidden' argument
-	Array arguments)
+	Expressions arguments)
 {
     elem* ep;
     elem* e;
--- a/dmd/expression/Cat.d	Mon Aug 30 18:42:04 2010 +0400
+++ b/dmd/expression/Cat.d	Mon Aug 30 16:12:19 2010 +0100
@@ -67,8 +67,8 @@
 		else
 		{   
 			// Create an ArrayLiteralExp
-			Expressions elements = new Expressions();
-			elements.push(cast(void*)e);
+			auto elements = new Expressions();
+			elements.push(e);
 			e = new ArrayLiteralExp(e.loc, elements);
 		}
 		e.type = type;
@@ -77,8 +77,8 @@
     else if (e1.op == TOKstring && e2.op == TOKstring)
     {
 		// Concatenate the strings
-		StringExp es1 = cast(StringExp)e1;
-		StringExp es2 = cast(StringExp)e2;
+		auto es1 = cast(StringExp)e1;
+		auto es2 = cast(StringExp)e2;
 		
 		size_t len = es1.len + es2.len;
 		int sz = es1.sz;
@@ -207,7 +207,7 @@
 		if (e1.op == TOKarrayliteral)
 		{   es1 = cast(ArrayLiteralExp)e1;
 			es1 = new ArrayLiteralExp(es1.loc, cast(Expressions)es1.elements.copy());
-			es1.elements.push(cast(void*)e2);
+			es1.elements.push(e2);
 		}
 		else
 		{
@@ -229,7 +229,7 @@
 		ArrayLiteralExp es2 = cast(ArrayLiteralExp)e2;
 
 		es2 = new ArrayLiteralExp(es2.loc, cast(Expressions)es2.elements.copy());
-		es2.elements.shift(cast(void*)e1);
+		es2.elements.shift(e1);
 		e = es2;
 
 		if (type.toBasetype().ty == Tsarray)
@@ -254,8 +254,8 @@
 		Type tb = t.toBasetype();
 		if (tb.ty == Tarray && tb.nextOf().equals(e.type))
 		{   
-			Expressions expressions = new Expressions();
-			expressions.push(cast(void*)e);
+			auto expressions = new Expressions();
+			expressions.push(e);
 			e = new ArrayLiteralExp(loc, expressions);
 			e.type = t;
 		}
--- a/dmd/expression/Equal.d	Mon Aug 30 18:42:04 2010 +0400
+++ b/dmd/expression/Equal.d	Mon Aug 30 16:12:19 2010 +0100
@@ -89,10 +89,10 @@
 		{
 			for (size_t i = 0; i < es1.elements.dim; i++)
 			{   
-				Expression ee1 = cast(Expression)es1.elements.data[i];
-				Expression ee2 = cast(Expression)es2.elements.data[i];
+				auto ee1 = es1.elements[i];
+				auto ee2 = es2.elements[i];
 
-				Expression v = Equal(TOK.TOKequal, Type.tint32, ee1, ee2);
+				auto v = Equal(TOK.TOKequal, Type.tint32, ee1, ee2);
 				if (v is EXP_CANT_INTERPRET)
 					return EXP_CANT_INTERPRET;
 				long tmp = v.toInteger();
@@ -124,7 +124,7 @@
 			for (size_t i = 0; i < dim1; i++)
 			{
 				ulong c = es1.charAt(i);
-				Expression ee2 = cast(Expression)es2.elements.data[i];
+				auto ee2 = es2.elements[i];
 				if (ee2.isConst() != 1)
 					return EXP_CANT_INTERPRET;
 				cmp = (c == ee2.toInteger());
@@ -151,8 +151,8 @@
 			cmp = true;
 			for (size_t i = 0; i < es1.elements.dim; i++)
 			{   
-				Expression ee1 = cast(Expression)es1.elements.data[i];
-				Expression ee2 = cast(Expression)es2.elements.data[i];
+				auto ee1 = es1.elements[i];
+				auto ee2 = es2.elements[i];
 
 				if (ee1 == ee2)
 					continue;
--- a/dmd/expression/Slice.d	Mon Aug 30 18:42:04 2010 +0400
+++ b/dmd/expression/Slice.d	Mon Aug 30 16:12:19 2010 +0100
@@ -36,7 +36,7 @@
 }
     if (e1.op == TOKstring && lwr.op == TOKint64 && upr.op == TOKint64)
     {	
-		StringExp es1 = cast(StringExp)e1;
+		auto es1 = cast(StringExp)e1;
 		ulong ilwr = lwr.toInteger();
 		ulong iupr = upr.toInteger();
 
@@ -51,7 +51,7 @@
 			memcpy(s, cast(ubyte*)es1.string_ + ilwr * sz, len * sz);
 			memset(s + len * sz, 0, sz);
 
-			StringExp es = new StringExp(loc, assumeUnique(s[0..len]), es1.postfix);
+			auto es = new StringExp(loc, assumeUnique(s[0..len]), es1.postfix);
 			es.sz = cast(ubyte)sz;
 			es.committed = 1;
 			es.type = type;
@@ -62,7 +62,7 @@
 	    lwr.op == TOKint64 && upr.op == TOKint64 &&
 	    !e1.checkSideEffect(2))
     {	
-		ArrayLiteralExp es1 = cast(ArrayLiteralExp)e1;
+		auto es1 = cast(ArrayLiteralExp)e1;
 		ulong ilwr = lwr.toInteger();
 		ulong iupr = upr.toInteger();
 
@@ -70,7 +70,7 @@
 			e1.error("array slice [%ju .. %ju] is out of bounds", ilwr, iupr);
 		else
 		{
-			Expressions elements = new Expressions();
+			auto elements = new Expressions();
 			elements.setDim(cast(uint)(iupr - ilwr));
 			memcpy(elements.data,
 			   es1.elements.data + ilwr,
--- a/dmd/expression/Util.d	Mon Aug 30 18:42:04 2010 +0400
+++ b/dmd/expression/Util.d	Mon Aug 30 16:12:19 2010 +0100
@@ -317,12 +317,9 @@
 {
     if (exps)
     {
-		for (size_t i = 0; i < exps.dim; i++)
+		foreach (ref Expression e; exps)
 		{   
-			Expression e = cast(Expression)exps.data[i];
-
 			e = e.semantic(sc);
-			exps.data[i] = cast(void*)e;
 		}
     }
 }
@@ -337,10 +334,8 @@
     {
 		expandTuples(exps);
 		
-		for (size_t i = 0; i < exps.dim; i++)
+		foreach (size_t i, ref Expression arg; exps)
 		{   
-			Expression arg = cast(Expression)exps.data[i];
-
 			if (!arg.type)
 			{
 debug {
@@ -353,7 +348,6 @@
 			}
 
 			arg = resolveProperties(sc, arg);
-			exps.data[i] = cast(void*) arg;
 
 			//arg.rvalue();
 static if (false) {
@@ -361,7 +355,6 @@
 			{
 				arg = new AddrExp(arg.loc, arg);
 				arg = arg.semantic(sc);
-				exps.data[i] = cast(void*) arg;
 			}
 }
 		}
@@ -503,7 +496,7 @@
 		Expression arg;
 
 		if (i < nargs)
-			arg = cast(Expression)arguments.data[i];
+			arg = arguments[i];
 		else
 			arg = null;
 
@@ -511,7 +504,7 @@
 
 		if (i < nparams)
 		{
-			Argument p = Argument.getNth(tf.parameters, i);
+			auto p = Argument.getNth(tf.parameters, i);
 
 			if (!arg)
 			{
@@ -537,7 +530,7 @@
 } else {
 				arg = arg.copy();
 }
-				arguments.push(cast(void*)arg);
+				arguments.push(arg);
 				nargs++;
 			}
 
@@ -581,13 +574,13 @@
 
 						for (size_t u = i; u < nargs; u++)
 						{   
-							Expression a = cast(Expression)arguments.data[u];
+							auto a = arguments[u];
 							if (tret && !(cast(TypeArray)tb).next.equals(a.type))
 								a = a.toDelegate(sc, tret);
 
 							Expression e = new VarExp(loc, v);
 							e = new IndexExp(loc, e, new IntegerExp(u + 1 - nparams));
-							AssignExp ae = new AssignExp(loc, e, a);
+							auto ae = new AssignExp(loc, e, a);
 
 			version (DMDV2) {
 							ae.op = TOK.TOKconstruct;
@@ -612,7 +605,7 @@
 						Expressions args = new Expressions();
 						args.setDim(nargs - i);
 						for (size_t u = i; u < nargs; u++)
-							args.data[u - i] = arguments.data[u];
+							args[u - i] = arguments[u];
 						arg = new NewExp(loc, null, null, p.type, args);
 						break;
 					}
@@ -768,7 +761,7 @@
 	}
 
 		arg = arg.optimize(WANT.WANTvalue);
-		arguments.data[i] = cast(void*) arg;
+		arguments[i] = arg;
 		if (done)
 			break;
     }
@@ -776,8 +769,8 @@
     // If D linkage and variadic, add _arguments[] as first argument
     if (tf.linkage == LINK.LINKd && tf.varargs == 1)
     {
-		Expression e = createTypeInfoArray(sc, cast(Expression*)&arguments.data[nparams], arguments.dim - nparams);
-		arguments.insert(0, cast(void*)e);
+		auto e = createTypeInfoArray(sc, &arguments[nparams], arguments.dim - nparams);
+		arguments.insert(0, e);
     }
 }
 
@@ -790,8 +783,8 @@
 {
     if (exps)
     {
-	for (size_t i = 0; i < exps.dim; i++)
-	{   Expression e = cast(Expression)exps.data[i];
+	foreach (e; exps)
+	{
 	    if (e && e.canThrow())
 		return true;
 	}
@@ -811,17 +804,17 @@
     {
 		for (size_t i = 0; i < exps.dim; i++)
 		{   
-			Expression arg = cast(Expression)exps.data[i];
+			auto arg = exps[i];
 			if (!arg)
 				continue;
 
 			// Look for tuple with 0 members
 			if (arg.op == TOK.TOKtype)
 			{
-				TypeExp e = cast(TypeExp)arg;
+				auto e = cast(TypeExp)arg;
 				if (e.type.toBasetype().ty == TY.Ttuple)
 				{   
-					TypeTuple tt = cast(TypeTuple)e.type.toBasetype();
+					auto tt = cast(TypeTuple)e.type.toBasetype();
 
 					if (!tt.arguments || tt.arguments.dim == 0)
 					{
@@ -837,7 +830,7 @@
 			// Inline expand all the tuples
 			while (arg.op == TOK.TOKtuple)
 			{	
-				TupleExp te = cast(TupleExp)arg;
+				auto te = cast(TupleExp)arg;
 
 				exps.remove(i);		// remove arg
 				exps.insert(i, te.exps);	// replace with tuple contents
@@ -845,7 +838,7 @@
 				if (i == exps.dim)
 					return;		// empty tuple, no more arguments
 
-				arg = cast(Expression)exps.data[i];
+				arg = exps[i];
 			}
 		}
     }
@@ -861,10 +854,8 @@
     {	
 		scope OutBuffer argbuf = new OutBuffer();
 
-		for (size_t i = 0; i < arguments.dim; i++)
+		foreach (size_t i, Expression arg; arguments)
 		{   
-			Expression arg = cast(Expression)arguments.data[i];
-
 			if (i)
 				buf.writeByte(',');
 
@@ -1071,7 +1062,7 @@
 Expression eval_builtin(BUILTIN builtin, Expressions arguments)
 {
 	assert(arguments && arguments.dim);
-    Expression arg0 = cast(Expression)arguments.data[0];
+    auto arg0 = arguments[0];
     Expression e = null;
     switch (builtin)
     {
@@ -1521,10 +1512,8 @@
 {
     if (arguments)
     {
-		for (size_t i = 0; i < arguments.dim; i++)
+		foreach (size_t i, Expression arg; arguments)
 		{   
-			Expression arg = cast(Expression)arguments.data[i];
-
 			if (arg)
 			{	
 				if (i)
@@ -1554,10 +1543,8 @@
     //printf("arrayExpressionScanForNestedRef(%p)\n", a);
     if (a)
     {
-		for (int i = 0; i < a.dim; i++)
+		foreach (e; a)
 		{   
-			Expression e = cast(Expression)a.data[i];
-
 			if (e)
 			{
 				e.scanForNestedRef(sc);
--- a/dmd/interpret/Util.d	Mon Aug 30 18:42:04 2010 +0400
+++ b/dmd/interpret/Util.d	Mon Aug 30 16:12:19 2010 +0100
@@ -24,14 +24,14 @@
 {
     if (!arguments || arguments.dim != 1)
 		return null;
-    Expression earg = cast(Expression)arguments.data[0];
+    auto earg = arguments[0];
     earg = earg.interpret(istate);
     if (earg is EXP_CANT_INTERPRET)
 		return null;
     if (earg.op != TOKassocarrayliteral)
 		return null;
-    AssocArrayLiteralExp aae = cast(AssocArrayLiteralExp)earg;
-    Expression e = new IntegerExp(aae.loc, aae.keys.dim, Type.tsize_t);
+    auto aae = cast(AssocArrayLiteralExp)earg;
+    auto e = new IntegerExp(aae.loc, aae.keys.dim, Type.tsize_t);
     return e;
 }
 
@@ -42,14 +42,14 @@
 }
     if (!arguments || arguments.dim != 2)
 		return null;
-    Expression earg = cast(Expression)arguments.data[0];
+    auto earg = arguments[0];
     earg = earg.interpret(istate);
     if (earg is EXP_CANT_INTERPRET)
 		return null;
     if (earg.op != TOKassocarrayliteral)
 		return null;
-    AssocArrayLiteralExp aae = cast(AssocArrayLiteralExp)earg;
-    Expression e = new ArrayLiteralExp(aae.loc, aae.keys);
+    auto aae = cast(AssocArrayLiteralExp)earg;
+    auto e = new ArrayLiteralExp(aae.loc, aae.keys);
     Type elemType = (cast(TypeAArray)aae.type).index;
     e.type = new TypeSArray(elemType, new IntegerExp(arguments ? arguments.dim : 0));
     return e;
@@ -60,14 +60,14 @@
     //printf("interpret_aaValues()\n");
     if (!arguments || arguments.dim != 3)
 		return null;
-    Expression earg = cast(Expression)arguments.data[0];
+    auto earg = arguments[0];
     earg = earg.interpret(istate);
     if (earg is EXP_CANT_INTERPRET)
 		return null;
     if (earg.op != TOKassocarrayliteral)
 		return null;
-    AssocArrayLiteralExp aae = cast(AssocArrayLiteralExp)earg;
-    Expression e = new ArrayLiteralExp(aae.loc, aae.values);
+    auto aae = cast(AssocArrayLiteralExp)earg;
+    auto e = new ArrayLiteralExp(aae.loc, aae.values);
     Type elemType = (cast(TypeAArray)aae.type).next;
     e.type = new TypeSArray(elemType, new IntegerExp(arguments ? arguments.dim : 0));
     //printf("result is %s\n", e.toChars());
@@ -125,16 +125,16 @@
 /***************************************
  * Duplicate the elements array, then set field 'indexToChange' = newelem.
  */
-Expressions changeOneElement(Expressions oldelems, size_t indexToChange, void* newelem)
+Expressions changeOneElement(Expressions oldelems, size_t indexToChange, Expression newelem)
 {
-    Expressions expsx = new Expressions();
+    auto expsx = new Expressions();
     expsx.setDim(oldelems.dim);
     for (size_t j = 0; j < expsx.dim; j++)
     {
 		if (j == indexToChange)
-			expsx.data[j] = newelem;
+			expsx[j] = newelem;
 		else
-			expsx.data[j] = oldelems.data[j];
+			expsx[j] = oldelems[j];
     }
     return expsx;
 }
@@ -144,14 +144,14 @@
  */
 Expressions spliceElements(Expressions oldelems, Expressions newelems, size_t insertpoint)
 {
-    Expressions expsx = new Expressions();
+    auto expsx = new Expressions();
     expsx.setDim(oldelems.dim);
     for (size_t j = 0; j < expsx.dim; j++)
     {
 		if (j >= insertpoint && j < insertpoint + newelems.dim)
-			expsx.data[j] = newelems.data[j - insertpoint];
+			expsx[j] = newelems[j - insertpoint];
 		else
-			expsx.data[j] = oldelems.data[j];
+			expsx[j] = oldelems[j];
     }
     return expsx;
 }
@@ -161,13 +161,13 @@
  */
 ArrayLiteralExp createBlockDuplicatedArrayLiteral(Type type, Expression elem, size_t dim)
 {
-    Expressions elements = new Expressions();
+    auto elements = new Expressions();
     elements.setDim(dim);
     for (size_t i = 0; i < dim; i++) {
-		elements.data[i] = cast(void*)elem;
+		elements[i] = elem;
 	}
 	
-    ArrayLiteralExp ae = new ArrayLiteralExp(Loc(0), elements);
+    auto ae = new ArrayLiteralExp(Loc(0), elements);
     ae.type = type;
     return ae;
 }
@@ -182,7 +182,7 @@
     structelems.setDim(sym.fields.dim);
     for (size_t j = 0; j < structelems.dim; j++)
     {
-		structelems.data[j] = cast(void*)(cast(VarDeclaration)(sym.fields[j])).type.defaultInit(Loc(0));
+		structelems[j] = sym.fields[j].type.defaultInit(Loc(0));
     }
     StructLiteralExp structinit = new StructLiteralExp(loc, sym, structelems);
     // Why doesn't the StructLiteralExp constructor do this, when