diff -uNr dmd-1.002/dmd/src/dmd/mars.c dmd-1.003/dmd/src/dmd/mars.c --- dmd-1.002/dmd/src/dmd/mars.c 2007-01-23 19:29:18.000000000 +0100 +++ dmd-1.003/dmd/src/dmd/mars.c 2007-01-25 01:51:20.000000000 +0100 @@ -60,7 +60,7 @@ copyright = "Copyright (c) 1999-2007 by Digital Mars"; written = "written by Walter Bright"; - version = "v1.002"; + version = "v1.003"; global.structalign = 8; memset(¶ms, 0, sizeof(Param)); diff -uNr dmd-1.002/dmd/src/dmd/module.c dmd-1.003/dmd/src/dmd/module.c --- dmd-1.002/dmd/src/dmd/module.c 2007-01-22 20:50:48.000000000 +0100 +++ dmd-1.003/dmd/src/dmd/module.c 2007-01-25 21:53:48.000000000 +0100 @@ -876,6 +876,7 @@ Dsymbol *s = todo[i]; s->semantic(NULL); + //printf("deferred: %s, parent = %s\n", s->toChars(), s->parent->toChars()); } //printf("\tdeferred.dim = %d, len = %d, dprogress = %d\n", deferred.dim, len, dprogress); } while (deferred.dim < len || dprogress); // while making progress diff -uNr dmd-1.002/dmd/src/dmd/template.c dmd-1.003/dmd/src/dmd/template.c --- dmd-1.002/dmd/src/dmd/template.c 2007-01-22 20:28:44.000000000 +0100 +++ dmd-1.003/dmd/src/dmd/template.c 2007-01-25 21:52:50.000000000 +0100 @@ -2549,6 +2549,17 @@ } #endif + /* If any of the instantiation members didn't get semantic() run + * on them due to forward references, we cannot run semantic2() + * or semantic3() yet. + */ + for (size_t i = 0; i < Module::deferred.dim; i++) + { Dsymbol *sd = (Dsymbol *)Module::deferred.data[i]; + + if (sd->parent == this) + goto Laftersemantic; + } + /* The problem is when to parse the initializer for a variable. * Perhaps VarDeclaration::semantic() should do it like it does * for initializers inside a function. @@ -2566,6 +2577,7 @@ semantic3(sc2); } + Laftersemantic: sc2->pop(); scope->pop(); diff -uNr dmd-1.002/dmd/src/phobos/std/outbuffer.d dmd-1.003/dmd/src/phobos/std/outbuffer.d --- dmd-1.002/dmd/src/phobos/std/outbuffer.d 2007-01-24 19:27:32.000000000 +0100 +++ dmd-1.003/dmd/src/phobos/std/outbuffer.d 2007-01-26 01:46:42.000000000 +0100 @@ -19,6 +19,7 @@ private { import std.string; + import std.gc; import std.c.stdio; import std.c.stdlib; import std.c.stdarg; @@ -79,6 +80,7 @@ if (data.length < offset + nbytes) { data.length = (offset + nbytes) * 2; + std.gc.hasPointers(data.ptr); } }