changeset 74:7e0d548de9e6

Switch Arrays of Dsymbols to the new templated Vector type
author Eldar Insafutdinov <e.insafutdinov@gmail.com>
date Sun, 29 Aug 2010 09:43:40 +0100
parents ef02e2e203c2
children cfa3747ebe4c ad4792a1cfd6
files bin/dmd.conf commands.linux.txt commands.txt dbg/CallStackInfo.d dbg/image/PE.d dmd/AggregateDeclaration.d dmd/AlignDeclaration.d dmd/AnonDeclaration.d dmd/Array.d dmd/ArrayTypes.d dmd/AttribDeclaration.d dmd/BinExp.d dmd/ClassDeclaration.d dmd/ConditionalDeclaration.d dmd/Dsymbol.d dmd/DtorDeclaration.d dmd/FuncDeclaration.d dmd/InterState.d dmd/LinkDeclaration.d dmd/Module.d dmd/OverloadSet.d dmd/Parser.d dmd/PragmaDeclaration.d dmd/ProtDeclaration.d dmd/ScopeDsymbol.d dmd/StaticIfDeclaration.d dmd/StorageClassDeclaration.d dmd/StructDeclaration.d dmd/TemplateDeclaration.d dmd/TemplateInstance.d dmd/Type.d dmd/VarDeclaration.d dmd/backend/glue.d dmd/codegen/Util.d dmd/interpret/Util.d main.d
diffstat 36 files changed, 376 insertions(+), 226 deletions(-) [+]
line wrap: on
line diff
--- a/bin/dmd.conf	Sat Aug 28 19:42:41 2010 +0400
+++ b/bin/dmd.conf	Sun Aug 29 09:43:40 2010 +0100
@@ -1,3 +1,3 @@
 [Environment]
-DFLAGS=-I%@P%/../dmd32/dmd2/src/druntime/import/ -I%@P%/../dmd32/dmd2/src/druntime/src/common/ -I%@P%/../dmd32/dmd2/src/phobos/ -L-L%@P%/../dmd32/dmd2/linux/lib
+DFLAGS=-I%@P%/../dmd33/dmd2/src/druntime/import/ -I%@P%/../dmd33/dmd2/src/druntime/src/common/ -I%@P%/../dmd33/dmd2/src/phobos/ -L-L%@P%/../dmd33/dmd2/linux/lib
 ;CC=i686-unknown-linux-gnu-gcc
--- a/commands.linux.txt	Sat Aug 28 19:42:41 2010 +0400
+++ b/commands.linux.txt	Sun Aug 29 09:43:40 2010 +0100
@@ -24,11 +24,9 @@
 -L-ldmd
 -L-lstdc++
 main.d
-dlib/CrashHandler.d
-dbg/ui/CrashWindow.d
+dbg/CallStackInfo.d 
 dbg/Debug.d
 dbg/symbol/CodeView.d
-dbg/image/PE.d
 dmd/AggregateDeclaration.d
 dmd/VarExp.d
 dmd/Tuple.d
@@ -45,6 +43,7 @@
 dmd/Port.d
 dmd/Gnuc.d
 dmd/declaration/Match.d
+dmd/interpret/Util.d
 dmd/templates/Util.d
 dmd/expression/Util.d
 dmd/expression/Add.d
@@ -87,6 +86,8 @@
 dmd/TypeInfoDelegateDeclaration.d
 dmd/TypeInfoTypedefDeclaration.d
 dmd/TypeInfoPointerDeclaration.d
+dmd/TypeInfoStaticArrayDeclaration.d
+dmd/TypeInfoAssociativeArrayDeclaration.d
 dmd/DsymbolExp.d
 dmd/GlobalExpressions.d
 dmd/NewExp.d
@@ -336,6 +337,7 @@
 dmd/TypeTypedef.d
 dmd/TypeTypeof.d
 dmd/TypedefDeclaration.d
+dmd/TypeInfoTupleDeclaration
 dmd/UnionDeclaration.d
 dmd/UnitTestDeclaration.d
 dmd/Utf.d
--- a/commands.txt	Sat Aug 28 19:42:41 2010 +0400
+++ b/commands.txt	Sun Aug 29 09:43:40 2010 +0100
@@ -14,10 +14,10 @@
 -version=SEH
 -version=OMFOBJ
 -version=SNAN_DEFAULT_INIT
--ofC:\dmd2.033\windows\bin\dmd.exe
+-ofbin\ddmd.exe
 bridge.obj
 ddmd.def
-C:\dmd2.033\src\dmd\dmd.lib
+dmd33\src\dmd\dmd.lib
 main.d
 dbg\CallStackInfo.d
 dbg\Debug.d
--- a/dbg/CallStackInfo.d	Sat Aug 28 19:42:41 2010 +0400
+++ b/dbg/CallStackInfo.d	Sun Aug 29 09:43:40 2010 +0100
@@ -31,6 +31,7 @@
 		bool skipFirst = false;
 		
 		size_t ip = void, bp = void;
+		version(Windows) {
 		if (e !is null) {
 			ip = e.ContextRecord.Eip;
 			bp = e.ContextRecord.Ebp;
@@ -42,6 +43,7 @@
 				mov bp, EBP;
 			}
 		}
+		}
 		
 		while (true) {
 			ip = cast(size_t)*(cast(void**)bp + 1);
@@ -124,33 +126,40 @@
 			frame = &frames[i];
 			frame.va = va;
 
-			// mbi.Allocation base is the handle to stack frame's module
-			VirtualQuery(cast(void*)va, &mbi, MEMORY_BASIC_INFORMATION.sizeof);
-			if(!mbi.AllocationBase) break;
+			version(Windows) {
+			    // mbi.Allocation base is the handle to stack frame's module
+			    VirtualQuery(cast(void*)va, &mbi, MEMORY_BASIC_INFORMATION.sizeof);
+			    if(!mbi.AllocationBase) break;
 
-			image = imageList;
-			while(image) {
-				if(image.baseAddress == cast(size_t)mbi.AllocationBase) break;
-				image = image.next;
-			}
+			    image = imageList;
+			    while(image) {
+				    if(image.baseAddress == cast(size_t)mbi.AllocationBase) break;
+				    image = image.next;
+			    }
 
-			if(!image) {
-				image = new DebugImage;
+			    if(!image) {
+				    image = new DebugImage;
 
-				with(*image) {
-					next = imageList;
-					imageList = image;
-					baseAddress = cast(size_t)mbi.AllocationBase;
+				    with(*image) {
+					    next = imageList;
+					    imageList = image;
+					    baseAddress = cast(size_t)mbi.AllocationBase;
 
-					len = GetModuleFileNameA(cast(HMODULE)baseAddress, buffer.ptr, buffer.length);
-					moduleName = buffer[0 .. len].idup;
-					if (len != 0) {
-						exeModule = new PEImage(moduleName);
-						rvaOffset = baseAddress + exeModule.codeOffset;
-						debugInfo = exeModule.debugInfo;
-					}
-				}
+					    len = GetModuleFileNameA(cast(HMODULE)baseAddress, buffer.ptr, buffer.length);
+					    moduleName = buffer[0 .. len].idup;
+					    if (len != 0) {
+						    exeModule = new PEImage(moduleName);
+						    rvaOffset = baseAddress + exeModule.codeOffset;
+						    debugInfo = exeModule.debugInfo;
+					    }
+				    }
+			    }
 			}
+			else version(POSIX)
+			{
+				assert(0);
+			}
+			else static assert(0);
 
 			frame.moduleName = image.moduleName;
 
@@ -175,11 +184,24 @@
 }
 
 void CrashHandlerInit() {
-	//SetErrorMode(SetErrorMode(0) | SEM_FAILCRITICALERRORS);
-	SetErrorMode(0);
-	SetUnhandledExceptionFilter(&UnhandledExceptionHandler);
+	version(Windows) {
+	    //SetErrorMode(SetErrorMode(0) | SEM_FAILCRITICALERRORS);
+	    SetErrorMode(0);
+	    SetUnhandledExceptionFilter(&UnhandledExceptionHandler);
+	}
+	else version(Posix) {
+	assert(0);
+	/+	sigaction_t sa;
+		sa.sa_handler = cast(sighandler_t)&SignalHandler;
+		sigemptyset(&sa.sa_mask);
+		sa.sa_flags = SA_RESTART | SA_SIGINFO;
+
+		sigaction(SIGILL, &sa, null);
+		sigaction(SIGFPE, &sa, null);
+		sigaction(SIGSEGV, &sa, null);+/
+	}
+	else static assert(0);
 }
-
 enum EXCEPTION_EXECUTE_HANDLER = 1;
 
 extern(Windows) int UnhandledExceptionHandler(EXCEPTION_POINTERS* e) {
@@ -256,4 +278,4 @@
 	BYTE[MAXIMUM_SUPPORTED_EXTENSION] ExtendedRegisters;
 }
 
-extern(C) Throwable _d_translate_se_to_d_exception(EXCEPTION_RECORD* exception_record);
\ No newline at end of file
+extern(C) Throwable _d_translate_se_to_d_exception(EXCEPTION_RECORD* exception_record);
--- a/dbg/image/PE.d	Sat Aug 28 19:42:41 2010 +0400
+++ b/dbg/image/PE.d	Sun Aug 29 09:43:40 2010 +0100
@@ -22,6 +22,8 @@
 //import sys.windows.Information : CloseHandle;
 //import sys.windows.Image;
 
+version(Windows)
+{
 import core.sys.windows.windows;
 
 class PEImage : IExecutableImage {
@@ -602,4 +604,6 @@
 	IMAGE_DEBUG_TYPE_OMAP_TO_SRC,
 	IMAGE_DEBUG_TYPE_OMAP_FROM_SRC,
 	IMAGE_DEBUG_TYPE_BORLAND // = 9
-}
\ No newline at end of file
+}
+
+}
--- a/dmd/AggregateDeclaration.d	Sat Aug 28 19:42:41 2010 +0400
+++ b/dmd/AggregateDeclaration.d	Sun Aug 29 09:43:40 2010 +0100
@@ -405,8 +405,8 @@
 			//printf("Building __fieldDtor()\n");
 			DtorDeclaration dd = new DtorDeclaration(Loc(0), Loc(0), Lexer.idPool("__fieldDtor"));
 			dd.fbody = new ExpStatement(Loc(0), e);
-			dtors.shift(cast(void*)dd);
-			members.push(cast(void*)dd);
+			dtors.shift(dd);
+			members.push(dd);
 			dd.semantic(sc);
 		}
 }
@@ -431,7 +431,7 @@
 				}
 				DtorDeclaration dd = new DtorDeclaration(Loc(0), Loc(0), Lexer.idPool("__aggrDtor"));
 				dd.fbody = new ExpStatement(Loc(0), e);
-				members.push(cast(void*)dd);
+				members.push(dd);
 				dd.semantic(sc);
 				return dd;
 		}
--- a/dmd/AlignDeclaration.d	Sat Aug 28 19:42:41 2010 +0400
+++ b/dmd/AlignDeclaration.d	Sun Aug 29 09:43:40 2010 +0100
@@ -11,7 +11,7 @@
 {
     uint salign;
 
-    this(uint sa, Array decl)
+    this(uint sa, Dsymbols decl)
 	{
 		super(decl);
 		salign = sa;
--- a/dmd/AnonDeclaration.d	Sat Aug 28 19:42:41 2010 +0400
+++ b/dmd/AnonDeclaration.d	Sun Aug 29 09:43:40 2010 +0100
@@ -18,7 +18,7 @@
 	int isunion;
 	int sem = 0;			// 1 if successful semantic()
 
-	this(Loc loc, int isunion, Array decl)
+	this(Loc loc, int isunion, Dsymbols decl)
 	{
 		super(decl);
 		this.loc = loc;
--- a/dmd/Array.d	Sat Aug 28 19:42:41 2010 +0400
+++ b/dmd/Array.d	Sun Aug 29 09:43:40 2010 +0100
@@ -180,3 +180,133 @@
 		return copyTo(new Array());
 	}
 }
+
+class Vector(T)
+{
+public:
+    @property final uint dim()
+    {
+        return _dim;
+    }
+    
+    @property T *data()
+    {
+        return _data;
+    }
+    
+    @property final uint allocdim()
+    {
+        return _allocdim;
+    }
+    
+    T opIndex(uint index)
+    {
+        return _data[index];
+    }
+    
+    void opIndexAssign(T value, uint index)
+    {
+        _data[index] = value;
+    }
+    
+    final T pop()
+    {        
+        T v = _data[--_dim];
+        _data[dim] = T.init;
+        return v;
+    }
+    
+    final void push(T elem)
+    {
+        reserve(1);
+        _data[_dim++] = elem;
+    }
+    
+    final void reserve(uint nentries)
+	{
+        //printf("Array::reserve: size = %d, offset = %d, nbytes = %d\n", size, offset, nbytes);
+        if (allocdim - dim < nentries) {
+            _allocdim = dim + nentries;
+            _data = cast(T*)GC.realloc(_data, allocdim * T.sizeof);
+        }
+	}
+    
+    final void shift(T ptr)
+    {
+        reserve(1);
+        memmove(_data + 1, _data, _dim * T.sizeof);
+        _data[0] = ptr;
+        _dim++;
+    }
+
+    final Vector!T copy()
+	{
+		return copyTo(new Vector!T());
+	}
+
+	final Vector!T copyTo(Vector!T a)
+	{
+		a.setDim(dim);
+		memcpy(a._data, _data, dim * T.sizeof);
+        // TODO call postblits
+		return a;
+	}
+    
+    final void setDim(uint newdim)
+	{
+		if (dim < newdim) {
+			reserve(newdim - dim);
+		}
+
+		_dim = newdim;
+	}
+    
+    int opApply(scope int delegate(ref T) dg)
+    {
+        int result = 0;
+
+	    for (int i = 0; i < _dim; i++)
+	    {
+    	    result = dg(_data[i]);
+	        if (result)
+		        break;
+	    }
+	    return result;
+    }
+
+    int opApply(scope int delegate(ref int key, ref T value) dg)
+    {
+        int result = 0;
+        for (int i = 0; i < _dim; i++)
+        {
+            result = dg(i, _data[i]);
+            if(result)
+                break;
+        }
+        return result;
+    }
+    
+    final void append(Vector!T a)
+	{
+		insert(dim, a);
+	}
+    
+    final void insert(uint index, Vector!T a)
+	{
+		if (a !is null) {
+			uint d = a.dim;
+			reserve(d);
+
+			if (dim != index) {
+				memmove(_data + index + d, _data + index, (dim - index) * T.sizeof);
+			}
+
+			memcpy(_data + index, a._data, d * T.sizeof);
+			_dim += d;
+		}
+	}
+private:
+    T* _data = null;
+    uint _dim = 0;
+    uint _allocdim = 0;
+}
\ No newline at end of file
--- a/dmd/ArrayTypes.d	Sat Aug 28 19:42:41 2010 +0400
+++ b/dmd/ArrayTypes.d	Sun Aug 29 09:43:40 2010 +0100
@@ -12,12 +12,10 @@
 
 class ClassDeclarations : Array { final typeof(this) copy() { auto a = new typeof(this); copyTo(a); return a; } }
 
-class Dsymbols : Array { final typeof(this) copy() { auto a = new typeof(this); copyTo(a); return a; } }
+//class Dsymbols : Array { final typeof(this) copy() { auto a = new typeof(this); copyTo(a); return a; } }
 
 class Objects : Array { final typeof(this) copy() { auto a = new typeof(this); copyTo(a); return a; } }
 
-class FuncDeclarations : Array { final typeof(this) copy() { auto a = new typeof(this); copyTo(a); return a; } }
-
 class Arguments : Array { final typeof(this) copy() { auto a = new typeof(this); copyTo(a); return a; } }
 
 class Identifiers : Array { final typeof(this) copy() { auto a = new typeof(this); copyTo(a); return a; } }
--- a/dmd/AttribDeclaration.d	Sat Aug 28 19:42:41 2010 +0400
+++ b/dmd/AttribDeclaration.d	Sun Aug 29 09:43:40 2010 +0100
@@ -13,14 +13,14 @@
 
 class AttribDeclaration : Dsymbol
 {
-    Array decl;	// array of Dsymbol's
+    Dsymbols decl;	// array of Dsymbol's
 
-    this(Array decl)
+    this(Dsymbols decl)
 	{
 		this.decl = decl;
 	}
 	
-    Array include(Scope sc, ScopeDsymbol sd)
+    Dsymbols include(Scope sc, ScopeDsymbol sd)
 	{
 		return decl;
 	}
@@ -28,15 +28,18 @@
     override bool addMember(Scope sc, ScopeDsymbol sd, bool memnum)
 	{
 		bool m = false;
-		Array d = include(sc, sd);
+		auto d = include(sc, sd);
 
 		if (d)
 		{
-			for (uint i = 0; i < d.dim; i++)
+            foreach(s; d)
+                m |= s.addMember(sc, sd, m | memnum);
+/*			for (uint i = 0; i < d.dim; i++)
 			{   
-				Dsymbol s = cast(Dsymbol)d.data[i];
+				auto s = d[i];
 				m |= s.addMember(sc, sd, m | memnum);
 			}
+            */
 		}
 
 		return m;
@@ -106,56 +109,46 @@
 	
     override void semantic(Scope sc)
 	{
-		Array d = include(sc, null);
+		auto d = include(sc, null);
 
 		//printf("\tAttribDeclaration::semantic '%s', d = %p\n",toChars(), d);
 		if (d)
 		{
-			for (uint i = 0; i < d.dim; i++)
-			{
-				Dsymbol s = cast(Dsymbol)d.data[i];
-
+			foreach(s; d)
 				s.semantic(sc);
-			}
 		}
 	}
 	
     override void semantic2(Scope sc)
 	{
-		Array d = include(sc, null);
+		auto d = include(sc, null);
 
 		if (d)
 		{
-			for (uint i = 0; i < d.dim; i++)
-			{   Dsymbol s = cast(Dsymbol)d.data[i];
+			foreach(s; d)
 				s.semantic2(sc);
-			}
 		}
 	}
 	
     override void semantic3(Scope sc)
 	{
-		Array d = include(sc, null);
+		auto d = include(sc, null);
 
 		if (d)
 		{
-			for (uint i = 0; i < d.dim; i++)
-			{   
-				Dsymbol s = cast(Dsymbol)d.data[i];
+			foreach(s; d)
 				s.semantic3(sc);
-			}
 		}
 	}
 	
     override void inlineScan()
 	{
-		Array d = include(null, null);
+		auto d = include(null, null);
 
 		if (d)
 		{
-			for (uint i = 0; i < d.dim; i++)
+			foreach(s; d)
 			{   
-				Dsymbol s = cast(Dsymbol)d.data[i];
 				//printf("AttribDeclaration.inlineScan %s\n", s.toChars());
 				s.inlineScan();
 			}
@@ -166,12 +159,11 @@
 	{
 		if (comment !is null)
 		{
-			Array d = include(null, null);
+			auto d = include(null, null);
 			if (d)
 			{
-				for (uint i = 0; i < d.dim; i++)
+				foreach(s; d)
 				{  
-					Dsymbol s = cast(Dsymbol)d.data[i];
 					//printf("AttribDeclaration::addComment %s\n", s.toChars());
 					s.addComment(comment);
 				}
@@ -191,51 +183,44 @@
 	
     override bool oneMember(Dsymbol* ps)
 	{
-		Array d = include(null, null);
+		auto d = include(null, null);
 
 		return Dsymbol.oneMembers(d, ps);
 	}
 	
     override bool hasPointers()
 	{
-		Array d = include(null, null);
+		auto d = include(null, null);
 
 		if (d)
 		{
-			for (size_t i = 0; i < d.dim; i++)
+			foreach(s; d)
 			{
-				Dsymbol s = cast(Dsymbol)d.data[i];
 				if (s.hasPointers())
 					return true;
 			}
 		}
 
-		return 0;
+		return false;
 	}
 	
     override void checkCtorConstInit()
 	{
-		Array d = include(null, null);
+		auto d = include(null, null);
 		if (d)
 		{
-			for (uint i = 0; i < d.dim; i++)
-			{   
-				Dsymbol s = cast(Dsymbol)d.data[i];
+			foreach(s; d)
 				s.checkCtorConstInit();
-			}
 		}
 	}
 	
     override void addLocalClass(ClassDeclarations aclasses)
 	{
-		Array d = include(null, null);
+		auto d = include(null, null);
 		if (d)
 		{
-			for (uint i = 0; i < d.dim; i++)
-			{   
-				Dsymbol s = cast(Dsymbol)d.data[i];
+			foreach(s; d)
 				s.addLocalClass(aclasses);
-			}
 		}
 	}
 	
@@ -248,15 +233,12 @@
 
     override void toObjFile(int multiobj)			// compile to .obj file
 	{
-		Array d = include(null, null);
+		auto d = include(null, null);
 
 		if (d)
 		{
-			for (uint i = 0; i < d.dim; i++)
-			{   
-				Dsymbol s = cast(Dsymbol)d.data[i];
+			foreach(s; d)
 				s.toObjFile(multiobj);
-			}
 		}
 	}
 	
--- a/dmd/BinExp.d	Sat Aug 28 19:42:41 2010 +0400
+++ b/dmd/BinExp.d	Sun Aug 29 09:43:40 2010 +0100
@@ -1630,7 +1630,7 @@
 				fd.protection = PROT.PROTpublic;
 				fd.linkage = LINKc;
 
-				sc.module_.importedFrom.members.push(cast(void*)fd);
+				sc.module_.importedFrom.members.push(fd);
 
 				sc = sc.push();
 				sc.parent = sc.module_.importedFrom;
--- a/dmd/ClassDeclaration.d	Sat Aug 28 19:42:41 2010 +0400
+++ b/dmd/ClassDeclaration.d	Sun Aug 29 09:43:40 2010 +0100
@@ -642,7 +642,7 @@
 						t = Type.tvoidptr;
 					assert(!vthis);
 					vthis = new ThisDeclaration(loc, t);
-					members.push(cast(void*)vthis);
+					members.push(vthis);
 				}
 			}
 		}
@@ -751,7 +751,7 @@
 		//printf("Creating default this(){} for class %s\n", toChars());
 		CtorDeclaration ctor = new CtorDeclaration(loc, Loc(0), null, 0);
 		ctor.fbody = new CompoundStatement(Loc(0), new Statements());
-		members.push(cast(void*)ctor);
+		members.push(ctor);
 		ctor.addMember(sc, this, true);
 		sc = scsave;	// why? What about sc.nofree?	///
 		sc.offset = structsize;
--- a/dmd/ConditionalDeclaration.d	Sat Aug 28 19:42:41 2010 +0400
+++ b/dmd/ConditionalDeclaration.d	Sun Aug 29 09:43:40 2010 +0100
@@ -12,9 +12,9 @@
 class ConditionalDeclaration : AttribDeclaration
 {
     Condition condition;
-    Array elsedecl;	// array of Dsymbol's for else block
+    Dsymbols elsedecl;	// array of Dsymbol's for else block
 
-    this(Condition condition, Array decl, Array elsedecl)
+    this(Condition condition, Dsymbols decl, Dsymbols elsedecl)
 	{
 		super(decl);
 		//printf("ConditionalDeclaration.ConditionalDeclaration()\n");
@@ -38,7 +38,7 @@
 		//printf("ConditionalDeclaration.oneMember(), inc = %d\n", condition.inc);
 		if (condition.inc)
 		{
-			Array d = condition.include(null, null) ? decl : elsedecl;
+			auto d = condition.include(null, null) ? decl : elsedecl;
 			return Dsymbol.oneMembers(d, ps);
 		}
 		*ps = null;
@@ -57,17 +57,15 @@
 	/* If generating doc comment, be careful because if we're inside
 	 * a template, then include(NULL, NULL) will fail.
 	 */
-	Array d = decl ? decl : elsedecl;
-	for (uint i = 0; i < d.dim; i++)
-	{   Dsymbol s = cast(Dsymbol)d.data[i];
+	auto d = decl ? decl : elsedecl;
+	foreach(s; d)
 	    s.emitComment(sc);
-	}
     }
 	}
 	
 	// Decide if 'then' or 'else' code should be included
 
-    override Array include(Scope sc, ScopeDsymbol sd)
+    override Dsymbols include(Scope sc, ScopeDsymbol sd)
 	{
 		//printf("ConditionalDeclaration.include()\n");
 		assert(condition);
@@ -84,18 +82,15 @@
 
 		if (comment)
 		{
-			Array d = decl;
+			auto d = decl;
 
 			for (int j = 0; j < 2; j++)
 			{
 				if (d)
 				{
-					for (uint i = 0; i < d.dim; i++)
-					{   
-						Dsymbol s = cast(Dsymbol)d.data[i];
+					foreach(s; d)
 						//printf("ConditionalDeclaration::addComment %s\n", s.toChars());
 						s.addComment(comment);
-					}
 				}
 				d = elsedecl;
 			}
--- a/dmd/Dsymbol.d	Sat Aug 28 19:42:41 2010 +0400
+++ b/dmd/Dsymbol.d	Sun Aug 29 09:43:40 2010 +0100
@@ -318,18 +318,18 @@
 	/*************************************
 	 * Do syntax copy of an array of Dsymbol's.
 	 */
-    static Array arraySyntaxCopy(Array a)
+    static Vector!Dsymbol arraySyntaxCopy(Vector!Dsymbol a)
 	{
-		Array b = null;
+		Vector!Dsymbol b = null;
 		if (a)
 		{
 			b = a.copy();
 			for (int i = 0; i < b.dim; i++)
 			{
-				Dsymbol s = cast(Dsymbol)b.data[i];
+				auto s = b[i];
 
 				s = s.syntaxCopy(null);
-				b.data[i] = cast(void*)s;
+				b[i] = s;
 			}
 		}
 		return b;
@@ -676,17 +676,15 @@
 	/*****************************************
 	 * Same as Dsymbol::oneMember(), but look at an array of Dsymbols.
 	 */
-    static bool oneMembers(Array members, Dsymbol* ps)
+    static bool oneMembers(Dsymbols members, Dsymbol* ps)
 	{
 		//printf("Dsymbol::oneMembers() %d\n", members ? members->dim : 0);
 		Dsymbol s = null;
 
 		if (members)
 		{
-			for (int i = 0; i < members.dim; i++)
+			foreach(sx; members)
 			{   
-				Dsymbol sx = cast(Dsymbol)members.data[i];
-
 				bool x = sx.oneMember(ps);
 				//printf("\t[%d] kind %s = %d, s = %p\n", i, sx->kind(), x, *ps);
 				if (!x)
@@ -899,3 +897,5 @@
     PragmaScope isPragmaScope() { return null; }
 }
 }
+
+alias Vector!Dsymbol Dsymbols;
\ No newline at end of file
--- a/dmd/DtorDeclaration.d	Sat Aug 28 19:42:41 2010 +0400
+++ b/dmd/DtorDeclaration.d	Sun Aug 29 09:43:40 2010 +0100
@@ -45,7 +45,7 @@
 			error("destructors are only for class/struct/union definitions, not %s %s", parent.kind(), parent.toChars());
 		}
 		else if (ident == Id.dtor)
-			ad.dtors.push(cast(void*)this);
+			ad.dtors.push(this);
 
 		type = new TypeFunction(null, Type.tvoid, false, LINK.LINKd);
 
--- a/dmd/FuncDeclaration.d	Sat Aug 28 19:42:41 2010 +0400
+++ b/dmd/FuncDeclaration.d	Sun Aug 29 09:43:40 2010 +0100
@@ -595,7 +595,7 @@
 			
 			/* Remember which functions this overrides
 			 */
-			foverrides.push(cast(void*)fdv);
+			foverrides.push(fdv);
 
 			/* This works by whenever this function is called,
 			 * it actually returns tintro, which gets dynamically
@@ -645,7 +645,7 @@
 				
 				/* Remember which functions this overrides
 				 */
-				foverrides.push(cast(void*)fdv);
+				foverrides.push(fdv);
 
 				if (fdv.tintro)
 					ti = fdv.tintro;
@@ -1098,7 +1098,7 @@
 			if (!sc2.insert(v))
 				error("parameter %s.%s is already defined", toChars(), v.toChars());
 			else
-				parameters.push(cast(void*)v);
+				parameters.push(v);
 			localsymtab.insert(v);
 			v.parent = this;
 			}
@@ -3743,3 +3743,5 @@
 
     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
--- a/dmd/InterState.d	Sat Aug 28 19:42:41 2010 +0400
+++ b/dmd/InterState.d	Sun Aug 29 09:43:40 2010 +0100
@@ -1,7 +1,7 @@
 module dmd.InterState;
 
 import dmd.FuncDeclaration;
-import dmd.ArrayTypes;
+import dmd.Dsymbol;
 import dmd.Expression;
 import dmd.Statement;
 
--- a/dmd/LinkDeclaration.d	Sat Aug 28 19:42:41 2010 +0400
+++ b/dmd/LinkDeclaration.d	Sun Aug 29 09:43:40 2010 +0100
@@ -12,7 +12,7 @@
 {
     LINK linkage;
 
-    this(LINK p, Array decl)
+    this(LINK p, Dsymbols decl)
 	{
 		super(decl);
 		//printf("LinkDeclaration(linkage = %d, decl = %p)\n", p, decl);
--- a/dmd/Module.d	Sat Aug 28 19:42:41 2010 +0400
+++ b/dmd/Module.d	Sun Aug 29 09:43:40 2010 +0100
@@ -634,7 +634,7 @@
 }
 		}
 
-		Parser p = new Parser(this, buf, buflen, docfile !is null);
+		auto p = new Parser(this, buf, buflen, docfile !is null);
 		p.nextToken();
 		members = p.parseModule();
 		md = p.md;
@@ -693,15 +693,14 @@
 		// Add import of "object" if this module isn't "object"
 		if (ident !is Id.object)
 		{
-			Import im = new Import(Loc(0), null, Id.object, null, 0);
-			members.shift(cast(void*)im);
+			auto im = new Import(Loc(0), null, Id.object, null, 0);
+			members.shift(im);
 		}
 
 		// Add all symbols into module's symbol table
 		symtab = new DsymbolTable();
-		for (i = 0; i < members.dim; i++)
+		foreach(s; members)
 		{	
-			Dsymbol s = cast(Dsymbol)members.data[i];
 			s.addMember(null, sc.scopesym, true);
 		}
 
--- a/dmd/OverloadSet.d	Sat Aug 28 19:42:41 2010 +0400
+++ b/dmd/OverloadSet.d	Sun Aug 29 09:43:40 2010 +0100
@@ -14,7 +14,7 @@
 	
     void push(Dsymbol s)
 	{
-		a.push(cast(void*)s);
+		a.push(s);
 	}
 	
     override OverloadSet isOverloadSet() { return this; }
--- a/dmd/Parser.d	Sat Aug 28 19:42:41 2010 +0400
+++ b/dmd/Parser.d	Sun Aug 29 09:43:40 2010 +0100
@@ -222,9 +222,9 @@
 		//nextToken();		// start up the scanner
 	}
 	
-    Array parseModule()
+    Dsymbols parseModule()
 	{
-		Array decldefs;
+		typeof(return) decldefs;
 
 		// ModuleDeclation leads off
 		if (token.value == TOK.TOKmodule)
@@ -299,15 +299,15 @@
 			nextToken();
 
 		nextToken();
-		return new Array();
+		return new Dsymbols();
 	}
 	
-    Array parseDeclDefs(int once)
+    Dsymbols parseDeclDefs(int once)
 	{
 		Dsymbol s;
-		Array decldefs;
-		Array a;
-		Array aelse;
+		Dsymbols decldefs;
+		Dsymbols a;
+		Dsymbols aelse;
 		PROT prot;
 		STC stc;
 		STC storageClass;
@@ -315,7 +315,7 @@
 		ubyte* comment;
 
 		//printf("Parser.parseDeclDefs()\n");
-		decldefs = new Array();
+		decldefs = new Dsymbols();
 		do
 		{
 		comment = token.blockComment;
@@ -733,7 +733,7 @@
 			continue;
 		}
 		if (s)
-		{   decldefs.push(cast(void*)s);
+		{   decldefs.push(s);
 			addComment(s, comment);
 		}
 		} while (!once);
@@ -748,9 +748,9 @@
 	 * Ends with scanner past closing ';'
 	 */
 version (DMDV2) {
-    Array parseAutoDeclarations(STC storageClass, ubyte* comment)
+    Dsymbols parseAutoDeclarations(STC storageClass, ubyte* comment)
 	{
-		Array a = new Array;
+		auto a = new Dsymbols;
 
 		while (true)
 		{
@@ -759,9 +759,9 @@
 			assert(token.value == TOKassign);
 			nextToken();		// skip over '='
 			Initializer init = parseInitializer();
-			VarDeclaration v = new VarDeclaration(loc, null, ident, init);
+			auto v = new VarDeclaration(loc, null, ident, init);
 			v.storage_class = storageClass;
-			a.push(cast(void*)v);
+			a.push(v);
 			if (token.value == TOKsemicolon)
 			{
 				nextToken();
@@ -789,9 +789,9 @@
 	/********************************************
 	 * Parse declarations after an align, protection, or extern decl.
 	 */
-    Array parseBlock()
+    Dsymbols parseBlock()
 	{
-		Array a = null;
+		Dsymbols a = null;
 		Dsymbol ss;
 
 		//printf("parseBlock()\n");
@@ -874,7 +874,7 @@
 		TemplateDeclaration tempdecl;
 		Identifier id;
 		TemplateParameters tpl;
-		Array decldefs;
+		Dsymbols decldefs;
 		Expression constraint = null;
 		Loc loc = this.loc;
 
@@ -1245,9 +1245,9 @@
 							if (tpl)
 							{   
 								// Wrap a template around function fd
-								Array decldefs = new Array();
-								decldefs.push(cast(void*)fd);
-								TemplateDeclaration tempdecl = new TemplateDeclaration(fd.loc, fd.ident, tpl, null, decldefs);
+								auto decldefs = new Dsymbols();
+								decldefs.push(fd);
+								auto tempdecl = new TemplateDeclaration(fd.loc, fd.ident, tpl, null, decldefs);
 								tempdecl.literal = 1;	// it's a template 'literal'
 								tiargs.push(cast(void*)tempdecl);
 								goto L1;
@@ -1594,10 +1594,9 @@
 			parseContracts(f);
 
 			// Wrap a template around it
-			Array decldefs = new Array();
-			decldefs.push(cast(void*)f);
-			TemplateDeclaration tempdecl =
-				new TemplateDeclaration(loc, f.ident, tpl, constraint, decldefs);
+			auto decldefs = new Dsymbols();
+			decldefs.push(f);
+			auto tempdecl =	new TemplateDeclaration(loc, f.ident, tpl, constraint, decldefs);
 			return tempdecl;
 		}
 
@@ -1903,7 +1902,7 @@
 		else if (token.value == TOK.TOKlcurly)
 		{
 			//printf("enum definition\n");
-			e.members = new Array();
+			e.members = new Dsymbols();
 			nextToken();
 			ubyte* comment = token.blockComment;
 			while (token.value != TOK.TOKrcurly)
@@ -1946,8 +1945,8 @@
 						error("if type, there must be an initializer");
 				}
 
-				EnumMember em = new EnumMember(loc, ident, value, type);
-				e.members.push(cast(void*)em);
+				auto em = new EnumMember(loc, ident, value, type);
+				e.members.push(em);
 
 				if (token.value == TOK.TOKrcurly) {
 					;
@@ -2050,7 +2049,7 @@
 		{
 		//printf("aggregate definition\n");
 		nextToken();
-		Array decl = parseDeclDefs(0);
+		auto decl = parseDeclDefs(0);
 		if (token.value != TOK.TOKrcurly)
 			error("} expected following member declarations in aggregate");
 		nextToken();
@@ -2072,10 +2071,9 @@
 		if (tpl)
 		{	// Wrap a template around the aggregate declaration
 
-		Array decldefs = new Array();
-		decldefs.push(cast(void*)a);
-		TemplateDeclaration tempdecl =
-			new TemplateDeclaration(loc, id, tpl, constraint, decldefs);
+		auto decldefs = new Dsymbols();
+		decldefs.push(a);
+		auto tempdecl =	new TemplateDeclaration(loc, id, tpl, constraint, decldefs);
 		return tempdecl;
 		}
 
@@ -2126,7 +2124,7 @@
 		return baseclasses;
 	}
 	
-    Import parseImport(Array decldefs, int isstatic)
+    Import parseImport(Dsymbols decldefs, int isstatic)
 	{
 		Import s;
 		Identifier id;
@@ -2170,7 +2168,7 @@
 			}
 
 			s = new Import(loc, a, id, aliasid, isstatic);
-			decldefs.push(cast(void*)s);
+			decldefs.push(s);
 
 			/* Look for
 			 *	: alias=name, alias=name;
@@ -2687,14 +2685,14 @@
 		return ts;
 	}
 	
-    Array parseDeclarations(STC storage_class)
+    Dsymbols parseDeclarations(STC storage_class)
 	{
 		STC stc;
 		Type ts;
 		Type t;
 		Type tfirst;
 		Identifier ident;
-		Array a;
+		Dsymbols a;
 		TOK tok = TOK.TOKreserved;
 		ubyte* comment = token.blockComment;
 		LINK link = linkage;
@@ -2719,8 +2717,8 @@
 				nextToken();
 				check(TOK.TOKthis);
 				check(TOK.TOKsemicolon);
-				a = new Array();
-				a.push(cast(void*)s);
+				a = new Dsymbols();
+				a.push(s);
 				addComment(s, comment);
 				return a;
 				}
@@ -2810,8 +2808,8 @@
 		{
 		AggregateDeclaration s = cast(AggregateDeclaration)parseAggregate();
 		s.storage_class |= storage_class;
-		a = new Array();
-		a.push(cast(void*)s);
+		a = new Dsymbols();
+		a.push(s);
 		addComment(s, comment);
 		return a;
 		}
@@ -2837,7 +2835,7 @@
 
 	L2:
 		tfirst = null;
-		a = new Array();
+		a = new Dsymbols();
 
 		while (1)
 		{
@@ -2873,13 +2871,13 @@
 			}
 			v.storage_class = storage_class;
 			if (link == linkage)
-			a.push(cast(void*)v);
+			a.push(v);
 			else
 			{
-			Array ax = new Array();
-			ax.push(cast(void*)v);
+			auto ax = new Dsymbols();
+			ax.push(v);
 			Dsymbol s = new LinkDeclaration(link, ax);
-			a.push(cast(void*)s);
+			a.push(s);
 			}
 			switch (token.value)
 			{   case TOK.TOKsemicolon:
@@ -2899,7 +2897,7 @@
 		}
 		else if (t.ty == TY.Tfunction)
 		{
-			TypeFunction tf = cast(TypeFunction)t;
+			auto tf = cast(TypeFunction)t;
 			Expression constraint = null;
 static if (false) {
 			if (Argument.isTPL(tf.parameters))
@@ -2922,8 +2920,8 @@
 			}
 			else
 			{
-			Array ax = new Array();
-			ax.push(cast(void*)f);
+			auto ax = new Dsymbols();
+			ax.push(f);
 			s = new LinkDeclaration(link, ax);
 			}
 			/* A template parameter list means it's a function template
@@ -2931,14 +2929,14 @@
 			if (tpl)
 			{
 			// Wrap a template around the function declaration
-			Array decldefs = new Array();
-			decldefs.push(cast(void*)s);
-			TemplateDeclaration tempdecl =
+			auto decldefs = new Dsymbols();
+			decldefs.push(s);
+			auto tempdecl =
 				new TemplateDeclaration(loc, s.ident, tpl, constraint, decldefs);
 			s = tempdecl;
 			}
 			addComment(s, comment);
-			a.push(cast(void*)s);
+			a.push(s);
 		}
 		else
 		{
@@ -2952,13 +2950,13 @@
 			VarDeclaration v = new VarDeclaration(loc, t, ident, init);
 			v.storage_class = storage_class;
 			if (link == linkage)
-			a.push(cast(void*)v);
+			a.push(v);
 			else
 			{
-			Array ax = new Array();
-			ax.push(cast(void*)v);
-			Dsymbol s = new LinkDeclaration(link, ax);
-			a.push(cast(void*)s);
+			auto ax = new Dsymbols();
+			ax.push(v);
+			auto s = new LinkDeclaration(link, ax);
+			a.push(s);
 			}
 			switch (token.value)
 			{   case TOK.TOKsemicolon:
@@ -3213,7 +3211,7 @@
 }
 	//	case TOK.TOKtypeof:
 		Ldeclaration:
-		{   Array a;
+		{   Dsymbols a;
 
 			a = parseDeclarations(STC.STCundefined);
 			if (a.dim > 1)
@@ -6054,7 +6052,7 @@
 			else
 			{
 				nextToken();
-				Array decl = parseDeclDefs(0);
+				auto decl = parseDeclDefs(0);
 				if (token.value != TOKrcurly)
 					error("class member expected");
 				nextToken();
--- a/dmd/PragmaDeclaration.d	Sat Aug 28 19:42:41 2010 +0400
+++ b/dmd/PragmaDeclaration.d	Sun Aug 29 09:43:40 2010 +0100
@@ -26,7 +26,7 @@
 {
     Expressions args;		// array of Expression's
 
-    this(Loc loc, Identifier ident, Expressions args, Array decl)
+    this(Loc loc, Identifier ident, Expressions args, Dsymbols decl)
 	{
 		super(decl);
 		this.loc = loc;
--- a/dmd/ProtDeclaration.d	Sat Aug 28 19:42:41 2010 +0400
+++ b/dmd/ProtDeclaration.d	Sun Aug 29 09:43:40 2010 +0100
@@ -12,7 +12,7 @@
 {
     PROT protection;
 
-    this(PROT p, Array decl)
+    this(PROT p, Dsymbols decl)
 	{
 		super(decl);
 
--- a/dmd/ScopeDsymbol.d	Sat Aug 28 19:42:41 2010 +0400
+++ b/dmd/ScopeDsymbol.d	Sun Aug 29 09:43:40 2010 +0100
@@ -20,7 +20,7 @@
 
 class ScopeDsymbol : Dsymbol
 {
-    Array members;		// all Dsymbol's in this scope
+    Dsymbols members;		// all Dsymbol's in this scope
     DsymbolTable symtab;	// members[] sorted into table
 
     Array imports;		// imported ScopeDsymbol's
@@ -115,13 +115,12 @@
 						a = new OverloadSet();
 						/* Don't add to a[] if s2 is alias of previous sym
 						 */
-						for (int j = 0; j < a.a.dim; j++)
+						foreach (int j, Dsymbol s3; a.a)
 						{	
-							Dsymbol s3 = cast(Dsymbol)a.a.data[j];
 							if (s2.toAlias() == s3.toAlias())
 							{
 								if (s3.isDeprecated())
-									a.a.data[j] = cast(void*)s2;
+									a.a[j] = s2;
 								goto Lcontinue;
 							}
 						}
@@ -266,12 +265,12 @@
 		assert(false);
 	}
 
-    static size_t dim(Array members)
+    static size_t dim(Dsymbols members)
 	{
 		assert(false);
 	}
 	
-    static Dsymbol getNth(Array members, size_t nth, size_t* pn = null)
+    static Dsymbol getNth(Dsymbols members, size_t nth, size_t* pn = null)
 	{
 		assert(false);
 	}
--- a/dmd/StaticIfDeclaration.d	Sat Aug 28 19:42:41 2010 +0400
+++ b/dmd/StaticIfDeclaration.d	Sun Aug 29 09:43:40 2010 +0100
@@ -13,7 +13,7 @@
     ScopeDsymbol sd;
     int addisdone;
 
-    this(Condition condition, Array decl, Array elsedecl)
+    this(Condition condition, Dsymbols decl, Dsymbols elsedecl)
 	{
 		super(condition, decl, elsedecl);
 		//printf("StaticIfDeclaration::StaticIfDeclaration()\n");
@@ -57,7 +57,7 @@
 	
     override void semantic(Scope sc)
 	{
-		Array d = include(sc, sd);
+		auto d = include(sc, sd);
 
 		//printf("\tStaticIfDeclaration.semantic '%s', d = %p\n",toChars(), d);
 		if (d)
--- a/dmd/StorageClassDeclaration.d	Sat Aug 28 19:42:41 2010 +0400
+++ b/dmd/StorageClassDeclaration.d	Sun Aug 29 09:43:40 2010 +0100
@@ -14,7 +14,7 @@
 {
     STC stc;
 
-    this(STC stc, Array decl)
+    this(STC stc, Dsymbols decl)
 	{
 		super(decl);
 		
--- a/dmd/StructDeclaration.d	Sat Aug 28 19:42:41 2010 +0400
+++ b/dmd/StructDeclaration.d	Sun Aug 29 09:43:40 2010 +0100
@@ -186,7 +186,7 @@
 						assert(!vthis);
 						vthis = new ThisDeclaration(loc, t);
 				//vthis.storage_class |= STC.STCref;
-						members.push(cast(void*)vthis);
+						members.push(vthis);
 					}
 				}
 			}
@@ -272,7 +272,7 @@
 					fdptr.fbody = new ReturnStatement(loc, e);
 					ScopeDsymbol ss = fdx.parent.isScopeDsymbol();
 					assert(ss);
-					ss.members.push(cast(void*)fdptr);
+					ss.members.push(fdptr);
 					fdptr.addMember(sc, ss, true);
 					fdptr.semantic(sc2);
 				}
@@ -523,7 +523,7 @@
 
 		fop.fbody = new CompoundStatement(Loc(0), s1, s2);
 
-		members.push(cast(void*)fop);
+		members.push(fop);
 		fop.addMember(sc, this, true);
 
 		sc = sc.push();
@@ -602,10 +602,10 @@
 		 */
 		if (e)
 		{	//printf("Building __fieldPostBlit()\n");
-		PostBlitDeclaration dd = new PostBlitDeclaration(Loc(0), Loc(0), Lexer.idPool("__fieldPostBlit"));
+		auto dd = new PostBlitDeclaration(Loc(0), Loc(0), Lexer.idPool("__fieldPostBlit"));
 		dd.fbody = new ExpStatement(Loc(0), e);
-		postblits.shift(cast(void*)dd);
-		members.push(cast(void*)dd);
+		postblits.shift(dd);
+		members.push(dd);
 		dd.semantic(sc);
 		}
 
@@ -626,9 +626,9 @@
 			ex = new CallExp(Loc(0), ex);
 			e = Expression.combine(e, ex);
 			}
-			PostBlitDeclaration dd = new PostBlitDeclaration(Loc(0), Loc(0), Lexer.idPool("__aggrPostBlit"));
+			auto dd = new PostBlitDeclaration(Loc(0), Loc(0), Lexer.idPool("__aggrPostBlit"));
 			dd.fbody = new ExpStatement(Loc(0), e);
-			members.push(cast(void*)dd);
+			members.push(dd);
 			dd.semantic(sc);
 			return dd;
 		}
@@ -686,7 +686,7 @@
 		s = new CompoundStatement(Loc(0), s, new ExpStatement(Loc(0), e));
 		fcp.fbody = s;
 
-		members.push(cast(void*)fcp);
+		members.push(fcp);
 
 		sc = sc.push();
 		sc.stc = STC.STCundefined;
--- a/dmd/TemplateDeclaration.d	Sat Aug 28 19:42:41 2010 +0400
+++ b/dmd/TemplateDeclaration.d	Sun Aug 29 09:43:40 2010 +0100
@@ -118,7 +118,7 @@
 
     int literal;		// this template declaration is a literal
 
-    this(Loc loc, Identifier id, TemplateParameters parameters, Expression constraint, Array decldefs)
+    this(Loc loc, Identifier id, TemplateParameters parameters, Expression constraint, Dsymbols decldefs)
 	{	
 		super(id);
 		
@@ -154,7 +154,7 @@
 		//printf("TemplateDeclaration.syntaxCopy()\n");
 		TemplateDeclaration td;
 		TemplateParameters p;
-		Array d;
+		Dsymbols d;
 
 		p = null;
 		if (parameters)
--- a/dmd/TemplateInstance.d	Sat Aug 28 19:42:41 2010 +0400
+++ b/dmd/TemplateInstance.d	Sun Aug 29 09:43:40 2010 +0100
@@ -401,7 +401,7 @@
 	static if (true) {
 		int dosemantic3 = 0;
 		{	
-			Array a;
+			Dsymbols a;
 
 			Scope scx = sc;
 	static if (false) {
@@ -440,11 +440,11 @@
 			{
 				if (i == a.dim)
 				{
-					a.push(cast(void*)this);
+					a.push(this);
 					break;
 				}
 
-				if (this is cast(Dsymbol)a.data[i])	// if already in Array
+				if (this is a[i])	// if already in Array
 					break;
 			}
 		}
--- a/dmd/Type.d	Sat Aug 28 19:42:41 2010 +0400
+++ b/dmd/Type.d	Sun Aug 29 09:43:40 2010 +0100
@@ -2123,7 +2123,7 @@
 				{	
 					// Find module that will go all the way to an object file
 					Module m = sc.module_.importedFrom;
-					m.members.push(cast(void*)t.vtinfo);
+					m.members.push(t.vtinfo);
 				}
 				else			// if in obj generation pass
 				{
--- a/dmd/VarDeclaration.d	Sat Aug 28 19:42:41 2010 +0400
+++ b/dmd/VarDeclaration.d	Sun Aug 29 09:43:40 2010 +0100
@@ -264,14 +264,14 @@
 			{	ti = new ExpInitializer(einit.loc, einit);
 			}
 
-			VarDeclaration v = new VarDeclaration(loc, arg.type, id, ti);
+			auto v = new VarDeclaration(loc, arg.type, id, ti);
 			//printf("declaring field %s of type %s\n", v.toChars(), v.type.toChars());
 			v.semantic(sc);
 
 			if (sc.scopesym)
 			{	//printf("adding %s to %s\n", v.toChars(), sc.scopesym.toChars());
 			if (sc.scopesym.members)
-				sc.scopesym.members.push(cast(void*)v);
+				sc.scopesym.members.push(v);
 			}
 
 			Expression e = new DsymbolExp(loc, v);
@@ -970,17 +970,16 @@
 					if (f == fdthis)
 						goto L1;
 				}
-				nestedrefs.push(cast(void*)fdthis);
+				nestedrefs.push(fdthis);
 			  L1: ;
 
-				for (int i = 0; i < fdv.closureVars.dim; i++)
+				foreach(s; fdv.closureVars)
 				{	
-					Dsymbol s = cast(Dsymbol)fdv.closureVars.data[i];
 					if (s == this)
 						goto L2;
 				}
 
-				fdv.closureVars.push(cast(void*)this);
+				fdv.closureVars.push(this);
 			  L2: ;
 
 				//printf("fdthis is %s\n", fdthis.toChars());
--- a/dmd/backend/glue.d	Sat Aug 28 19:42:41 2010 +0400
+++ b/dmd/backend/glue.d	Sun Aug 29 09:43:40 2010 +0100
@@ -391,15 +391,15 @@
 		/* Create a module that's a doppelganger of m, with just
 		 * enough to be able to create the moduleinfo.
 		 */
-		OutBuffer idbuf = new OutBuffer();
+		auto idbuf = new OutBuffer();
 		idbuf.printf("%s.%d", m ? m.ident.toChars() : mname, count);
 		string idstr = idbuf.extractString();
 		idbuf.data = null;
 		Identifier id = new Identifier(idstr, TOK.TOKidentifier);
 
-		Module md = new Module(mname, id, 0, 0);
-		md.members = new Array();
-		md.members.push(cast(void*)s);	// its only 'member' is s
+		auto md = new Module(mname, id, 0, 0);
+		md.members = new Dsymbols();
+		md.members.push(s);	// its only 'member' is s
 		if (m)
 		{
 			md.doppelganger = 1;	// identify this module as doppelganger
--- a/dmd/codegen/Util.d	Sat Aug 28 19:42:41 2010 +0400
+++ b/dmd/codegen/Util.d	Sun Aug 29 09:43:40 2010 +0100
@@ -662,14 +662,11 @@
     ad = s.isAttribDeclaration();
     if (ad)
     {
-		Array decl = ad.include(null, null);
+		auto decl = ad.include(null, null);
 		if (decl && decl.dim)
 		{
-			for (size_t i = 0; i < decl.dim; i++)
-			{
-				s = cast(Dsymbol)decl.data[i];
+			foreach(s; decl)
 				e = el_combine(e, Dsymbol_toElem(s, irs));
-			}
 		}
     }
     else if ((vd = s.isVarDeclaration()) !is null)
--- a/dmd/interpret/Util.d	Sat Aug 28 19:42:41 2010 +0400
+++ b/dmd/interpret/Util.d	Sun Aug 29 09:43:40 2010 +0100
@@ -202,11 +202,11 @@
 		{
 			if (i == istate.vars.dim)
 			{   
-				istate.vars.push(cast(void*)v);
+				istate.vars.push(v);
 				//printf("\tadding %s to istate\n", v.toChars());
 				break;
 			}
-			if (v == cast(VarDeclaration)istate.vars.data[i])
+			if (v == cast(VarDeclaration)istate.vars[i])
 				break;
 		}
     }
--- a/main.d	Sat Aug 28 19:42:41 2010 +0400
+++ b/main.d	Sun Aug 29 09:43:40 2010 +0100
@@ -40,6 +40,19 @@
 	EXIT_SUCCESS = 0,
 }
 
+version(Linux)
+{
+extern (C) extern __gshared bool rt_trapExceptions;
+
+static this() {
+	rt_trapExceptions = false;
+}
+
+}
+
+version(Windows)
+{
+
 version (Windows)
 {
     private import core.stdc.wchar_;
@@ -58,6 +71,14 @@
 shared bool _d_isHalting = false;
 __gshared string[] _d_args = null;
 
+version(Posix)
+{
+    extern (C) void _STI_monitor_staticctor();
+    extern (C) void _STD_monitor_staticdtor();
+    extern (C) void _STI_critical_init();
+    extern (C) void _STD_critical_term();
+}
+
 extern (C) void gc_init();
 extern (C) void gc_term();
 extern (C) void _minit();
@@ -178,6 +199,8 @@
     return result;
 }
 
+}
+
 int main(string[] args)
 {
     GC.disable();