diff -uNr dmd-0.126/dmd/src/dmd/class.c dmd-0.127/dmd/src/dmd/class.c --- dmd-0.126/dmd/src/dmd/class.c 2005-06-06 14:55:44.000000000 +0200 +++ dmd-0.127/dmd/src/dmd/class.c 2005-06-14 14:47:00.000000000 +0200 @@ -623,7 +623,9 @@ else { s = b->base->search(ident, flags); - if (s) + if (s == this) // happens if s is nested in this and derives from this + s = NULL; + else if (s) break; } } diff -uNr dmd-0.126/dmd/src/dmd/cond.c dmd-0.127/dmd/src/dmd/cond.c --- dmd-0.126/dmd/src/dmd/cond.c 2005-05-26 17:20:04.000000000 +0200 +++ dmd-0.127/dmd/src/dmd/cond.c 2005-06-16 13:03:42.000000000 +0200 @@ -91,6 +91,11 @@ inc = 1; else if (findCondition(global.params.debugids, ident)) inc = 1; + else + { if (!mod->debugidsNot) + mod->debugidsNot = new Array(); + mod->debugidsNot->push(ident->toChars()); + } } else if (level <= global.params.debuglevel || level <= mod->debuglevel) inc = 1; @@ -162,6 +167,7 @@ int VersionCondition::include(Scope *sc, ScopeDsymbol *s) { //printf("VersionCondition::include() level = %d, versionlevel = %d\n", level, global.params.versionlevel); + //if (ident) printf("\tident = '%s'\n", ident->toChars()); if (inc == 0) { inc = 2; @@ -171,6 +177,11 @@ inc = 1; else if (findCondition(global.params.versionids, ident)) inc = 1; + else + { if (!mod->versionidsNot) + mod->versionidsNot = new Array(); + mod->versionidsNot->push(ident->toChars()); + } } else if (level <= global.params.versionlevel || level <= mod->versionlevel) inc = 1; diff -uNr dmd-0.126/dmd/src/dmd/cond.h dmd-0.127/dmd/src/dmd/cond.h --- dmd-0.126/dmd/src/dmd/cond.h 2005-05-25 13:11:24.000000000 +0200 +++ dmd-0.127/dmd/src/dmd/cond.h 2005-06-16 13:00:48.000000000 +0200 @@ -18,6 +18,8 @@ struct ScopeDsymbol; enum TOK; +int findCondition(Array *ids, Identifier *ident); + struct Condition { Loc loc; diff -uNr dmd-0.126/dmd/src/dmd/declaration.c dmd-0.127/dmd/src/dmd/declaration.c --- dmd-0.126/dmd/src/dmd/declaration.c 2005-06-01 13:48:00.000000000 +0200 +++ dmd-0.127/dmd/src/dmd/declaration.c 2005-06-14 01:09:34.000000000 +0200 @@ -550,7 +550,11 @@ t = t->next->toBasetype(); if (t->ty != Tsarray) break; - dim *= ((TypeSArray *)t)->dim->toInteger(); + if (t->next->toBasetype()->ty == Tbit) + // t->size() gives size in bytes, convert to bits + dim *= t->size() * 8; + else + dim *= ((TypeSArray *)t)->dim->toInteger(); e1->type = new TypeSArray(t->next, new IntegerExp(0, dim, Type::tindex)); } e1 = new SliceExp(loc, e1, NULL, NULL); diff -uNr dmd-0.126/dmd/src/dmd/expression.c dmd-0.127/dmd/src/dmd/expression.c --- dmd-0.126/dmd/src/dmd/expression.c 2005-06-07 20:31:24.000000000 +0200 +++ dmd-0.127/dmd/src/dmd/expression.c 2005-06-14 01:15:06.000000000 +0200 @@ -1782,7 +1782,7 @@ if (cdn) { - if (sc->func->isThis() != cdn) + if (!sc->func || sc->func->isThis() != cdn) error("no 'this' for nested class %s", cd->toChars()); } } @@ -2944,6 +2944,15 @@ e1 = new DotVarExp(loc, e1, tcd->vthis); e1 = e1->semantic(sc); + + // Skip over nested functions, and get the enclosing + // class type. + Dsymbol *s = tcd->toParent(); + while (s && s->isFuncDeclaration()) + s = s->toParent(); + if (s && s->isClassDeclaration()) + e1->type = s->isClassDeclaration()->type; + goto L1; } error("this for %s needs to be type %s not type %s", @@ -2953,6 +2962,7 @@ accessCheck(loc, sc, e1, var); } } + //printf("-DotVarExp::semantic('%s')\n", toChars()); return this; } @@ -3873,8 +3883,6 @@ default: if (e1->op == TOKindex) { - if (!global.params.useDeprecated) - error("delete aa[key] deprecated, use aa.remove(key)"); IndexExp *ae = (IndexExp *)(e1); Type *tb1 = ae->e1->type->toBasetype(); if (tb1->ty == Taarray) @@ -3883,6 +3891,17 @@ error("cannot delete type %s", e1->type->toChars()); break; } + + if (e1->op == TOKindex) + { + IndexExp *ae = (IndexExp *)(e1); + Type *tb1 = ae->e1->type->toBasetype(); + if (tb1->ty == Taarray) + { if (!global.params.useDeprecated) + error("delete aa[key] deprecated, use aa.remove(key)"); + } + } + return this; } diff -uNr dmd-0.126/dmd/src/dmd/lexer.c dmd-0.127/dmd/src/dmd/lexer.c --- dmd-0.126/dmd/src/dmd/lexer.c 2005-05-25 21:53:02.000000000 +0200 +++ dmd-0.127/dmd/src/dmd/lexer.c 2005-06-13 02:30:40.000000000 +0200 @@ -2244,7 +2244,7 @@ Token::tochars[TOKor] = "|"; Token::tochars[TOKoror] = "||"; Token::tochars[TOKarray] = "[]"; - Token::tochars[TOKindex] = "[]"; + Token::tochars[TOKindex] = "[i]"; Token::tochars[TOKaddress] = "#"; Token::tochars[TOKstar] = "*"; Token::tochars[TOKtilde] = "~"; diff -uNr dmd-0.126/dmd/src/dmd/mars.c dmd-0.127/dmd/src/dmd/mars.c --- dmd-0.126/dmd/src/dmd/mars.c 2005-05-27 01:16:28.000000000 +0200 +++ dmd-0.127/dmd/src/dmd/mars.c 2005-06-07 22:34:32.000000000 +0200 @@ -49,7 +49,7 @@ copyright = "Copyright (c) 1999-2005 by Digital Mars"; written = "written by Walter Bright"; - version = "v0.126"; + version = "v0.127"; global.structalign = 8; memset(¶ms, 0, sizeof(Param)); diff -uNr dmd-0.126/dmd/src/dmd/module.c dmd-0.127/dmd/src/dmd/module.c --- dmd-0.126/dmd/src/dmd/module.c 2005-05-12 18:51:46.000000000 +0200 +++ dmd-0.127/dmd/src/dmd/module.c 2005-06-16 12:50:48.000000000 +0200 @@ -68,8 +68,10 @@ debuglevel = 0; debugids = NULL; + debugidsNot = NULL; versionlevel = 0; versionids = NULL; + versionidsNot = NULL; srcfilename = FileName::defaultExt(filename, global.mars_ext); if (!srcfilename->equalsExt(global.mars_ext)) @@ -598,6 +600,7 @@ * need to stop infinite recursive searches. */ + //printf("%s Module::search('%s', flags = %d) insearch = %d\n", toChars(), ident->toChars(), flags, insearch); Dsymbol *s; if (insearch) s = NULL; diff -uNr dmd-0.126/dmd/src/dmd/module.h dmd-0.127/dmd/src/dmd/module.h --- dmd-0.126/dmd/src/dmd/module.h 2005-05-10 14:16:48.000000000 +0200 +++ dmd-0.127/dmd/src/dmd/module.h 2005-06-16 12:50:48.000000000 +0200 @@ -72,9 +72,11 @@ unsigned debuglevel; // debug level Array *debugids; // debug identifiers + Array *debugidsNot; // forward referenced debug identifiers unsigned versionlevel; // version level Array *versionids; // version identifiers + Array *versionidsNot; // forward referenced version identifiers Module(char *arg, Identifier *ident); diff -uNr dmd-0.126/dmd/src/dmd/mtype.c dmd-0.127/dmd/src/dmd/mtype.c --- dmd-0.126/dmd/src/dmd/mtype.c 2005-05-25 21:58:10.000000000 +0200 +++ dmd-0.127/dmd/src/dmd/mtype.c 2005-06-14 14:47:24.000000000 +0200 @@ -2767,7 +2767,7 @@ if (si) { s = si->search(s->ident, 0); - if (s) + if (s && s != si) goto L1; s = si; } diff -uNr dmd-0.126/dmd/src/dmd/parse.c dmd-0.127/dmd/src/dmd/parse.c --- dmd-0.126/dmd/src/dmd/parse.c 2005-06-06 12:14:56.000000000 +0200 +++ dmd-0.127/dmd/src/dmd/parse.c 2005-06-15 12:52:18.000000000 +0200 @@ -2286,10 +2286,16 @@ return ia; case TOKvoid: - nextToken(); - return new VoidInitializer(loc); + t = peek(&token); + if (t->value == TOKsemicolon) + { + nextToken(); + return new VoidInitializer(loc); + } + goto Lexpression; default: + Lexpression: e = parseAssignExp(); ie = new ExpInitializer(loc, e); return ie; diff -uNr dmd-0.126/dmd/src/dmd/todt.c dmd-0.127/dmd/src/dmd/todt.c --- dmd-0.126/dmd/src/dmd/todt.c 2005-06-01 14:21:16.000000000 +0200 +++ dmd-0.127/dmd/src/dmd/todt.c 2005-06-16 01:01:44.000000000 +0200 @@ -172,7 +172,7 @@ dt_t *d; dt_t **pdtend; - //printf("dim = %d\n", dim); + //printf("\tdim = %d\n", dim); dts.setDim(dim); dts.zero(); @@ -186,7 +186,7 @@ idx = (Expression *)index.data[i]; if (idx) length = idx->toInteger(); - //printf("index[%d] = %p, length = %u, dim = %u\n", i, idx, length, dim); + //printf("\tindex[%d] = %p, length = %u, dim = %u\n", i, idx, length, dim); assert(length < dim); val = (Initializer *)value.data[i]; @@ -199,6 +199,13 @@ Expression *edefault = tb->next->defaultInit(); + unsigned n = 1; + for (Type *tbn = tn; tbn->ty == Tsarray; tbn = tbn->next->toBasetype()) + { TypeSArray *tsa = (TypeSArray *)tbn; + + n *= tsa->dim->toInteger(); + } + d = NULL; pdtend = &d; for (i = 0; i < dim; i++) @@ -207,7 +214,10 @@ if (dt) pdtend = dtcat(pdtend, dt); else - pdtend = edefault->toDt(pdtend); + { + for (int j = 0; j < n; j++) + pdtend = edefault->toDt(pdtend); + } } switch (tb->ty) { @@ -224,7 +234,9 @@ else { for (i = dim; i < tadim; i++) - pdtend = edefault->toDt(pdtend); + { for (int j = 0; j < n; j++) + pdtend = edefault->toDt(pdtend); + } } } else if (dim > tadim) diff -uNr dmd-0.126/dmd/src/dmd/version.c dmd-0.127/dmd/src/dmd/version.c --- dmd-0.126/dmd/src/dmd/version.c 2005-05-14 23:15:46.000000000 +0200 +++ dmd-0.127/dmd/src/dmd/version.c 2005-06-16 13:00:24.000000000 +0200 @@ -59,6 +59,8 @@ error("declaration must be at module level"); else { + if (findCondition(m->debugidsNot, ident)) + error("defined after use"); if (!m->debugids) m->debugids = new Array(); m->debugids->push(ident->toChars()); @@ -137,6 +139,8 @@ error("declaration must be at module level"); else { + if (findCondition(m->versionidsNot, ident)) + error("defined after use"); if (!m->versionids) m->versionids = new Array(); m->versionids->push(ident->toChars()); diff -uNr dmd-0.126/dmd/src/phobos/std/zip.d dmd-0.127/dmd/src/phobos/std/zip.d --- dmd-0.126/dmd/src/phobos/std/zip.d 2005-06-07 21:54:12.000000000 +0200 +++ dmd-0.127/dmd/src/phobos/std/zip.d 2005-06-16 21:53:56.000000000 +0200 @@ -100,7 +100,7 @@ void deleteMember(ArchiveMember de) { - delete directory[de.name]; + directory.remove(de.name); } void[] build()