diff -uNr dmd-0.157/dmd/src/dmd/attrib.c dmd-0.158/dmd/src/dmd/attrib.c --- dmd-0.157/dmd/src/dmd/attrib.c 2006-04-25 19:43:00.000000000 +0200 +++ dmd-0.158/dmd/src/dmd/attrib.c 2006-05-24 20:05:14.000000000 +0200 @@ -539,6 +539,7 @@ { this->loc = loc; this->isunion = isunion; + this->scope = NULL; } Dsymbol *AnonDeclaration::syntaxCopy(Dsymbol *s) @@ -553,6 +554,14 @@ void AnonDeclaration::semantic(Scope *sc) { //printf("\tAnonDeclaration::semantic '%s'\n",toChars()); + + Scope *scx = NULL; + if (scope) + { sc = scope; + scx = scope; + scope = NULL; + } + assert(sc->parent); Dsymbol *parent = sc->parent->pastMixin(); @@ -590,9 +599,24 @@ s->semantic(sc); if (isunion) sc->offset = 0; + if (aad.sizeok == 2) + { + break; + } } *sc = sc_save; + // If failed due to forward references, unwind and try again later + if (aad.sizeok == 2) + { + ad->sizeok = 2; + scope = scx ? scx : new Scope(*sc); + scope->setNoFree(); + scope->module->addDeferredSemantic(this); + return; + } + Module::dprogress++; + // 0 sized structs are set to 1 byte if (aad.structsize == 0) { @@ -700,6 +724,7 @@ } fprintf(stdmsg, "\n"); } + goto Lnodecl; } else if (ident == Id::lib) { @@ -714,6 +739,7 @@ if (e->op != TOKstring) error("string expected for library name, not '%s'", e->toChars()); } + goto Lnodecl; } #if IN_GCC else if (ident == Id::GNU_asm) @@ -748,6 +774,7 @@ if (d && s) d->c_ident = Lexer::idPool((char*) s->string); } + goto Lnodecl; } #endif else @@ -762,6 +789,11 @@ s->semantic(sc); } } + return; + +Lnodecl: + if (decl) + error("pragma is missing closing ';'"); } int PragmaDeclaration::oneMember(Dsymbol **ps) @@ -791,6 +823,7 @@ name[se->len] = 0; obj_includelib(name); } + AttribDeclaration::toObjFile(); } void PragmaDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs) diff -uNr dmd-0.157/dmd/src/dmd/attrib.h dmd-0.158/dmd/src/dmd/attrib.h --- dmd-0.157/dmd/src/dmd/attrib.h 2006-04-24 21:10:50.000000000 +0200 +++ dmd-0.158/dmd/src/dmd/attrib.h 2006-05-13 00:02:06.000000000 +0200 @@ -97,6 +97,7 @@ struct AnonDeclaration : AttribDeclaration { int isunion; + Scope *scope; // !=NULL means context to use AnonDeclaration(Loc loc, int isunion, Array *decl); Dsymbol *syntaxCopy(Dsymbol *s); diff -uNr dmd-0.157/dmd/src/dmd/class.c dmd-0.158/dmd/src/dmd/class.c --- dmd-0.157/dmd/src/dmd/class.c 2006-04-25 01:21:48.000000000 +0200 +++ dmd-0.158/dmd/src/dmd/class.c 2006-05-12 10:53:44.000000000 +0200 @@ -265,7 +265,7 @@ goto L7; } } - if (!tc->sym->symtab || tc->sym->scope) + if (!tc->sym->symtab || tc->sym->scope || tc->sym->sizeok == 0) { //error("forward reference of base class %s", baseClass->toChars()); // Forward reference of base class, try again later @@ -284,6 +284,7 @@ } } + // Treat the remaining entries in baseclasses as interfaces // Check for errors, handle forward references for (i = (baseClass ? 1 : 0); i < baseclasses.dim; ) { TypeClass *tc; @@ -471,6 +472,8 @@ scope = scx ? scx : new Scope(*sc); scope->setNoFree(); scope->module->addDeferredSemantic(this); + + //printf("\tsemantic('%s') failed\n", toChars()); return; } @@ -545,6 +548,8 @@ } structsize = sc->offset; sizeok = 1; + Module::dprogress++; + sc->pop(); diff -uNr dmd-0.157/dmd/src/dmd/declaration.c dmd-0.158/dmd/src/dmd/declaration.c --- dmd-0.157/dmd/src/dmd/declaration.c 2006-04-17 23:17:32.000000000 +0200 +++ dmd-0.158/dmd/src/dmd/declaration.c 2006-05-24 13:37:52.000000000 +0200 @@ -340,6 +340,7 @@ ScopeDsymbol::multiplyDefined(f, overnext); overnext = NULL; s = fa; + s->parent = sc->parent; } } if (overnext) diff -uNr dmd-0.157/dmd/src/dmd/doc.c dmd-0.158/dmd/src/dmd/doc.c --- dmd-0.157/dmd/src/dmd/doc.c 2006-04-24 21:12:30.000000000 +0200 +++ dmd-0.158/dmd/src/dmd/doc.c 2006-05-22 16:33:26.000000000 +0200 @@ -102,7 +102,7 @@
\n\