diff -uNr dmd-0.104/dmd/src/dmd/declaration.c dmd-0.105/dmd/src/dmd/declaration.c --- dmd-0.104/dmd/src/dmd/declaration.c 2004-10-02 06:26:10.000000000 +0200 +++ dmd-0.105/dmd/src/dmd/declaration.c 2004-10-25 18:30:14.000000000 +0200 @@ -556,6 +556,10 @@ else { init = init->semantic(sc, type); + if (fd && isConst() && !isStatic()) + { // Make it static + storage_class |= STCstatic; + } } } } diff -uNr dmd-0.104/dmd/src/dmd/dsymbol.c dmd-0.105/dmd/src/dmd/dsymbol.c --- dmd-0.104/dmd/src/dmd/dsymbol.c 2004-10-03 17:22:08.000000000 +0200 +++ dmd-0.105/dmd/src/dmd/dsymbol.c 2004-10-27 20:14:04.000000000 +0200 @@ -135,7 +135,12 @@ Dsymbol *Dsymbol::toParent() { - Dsymbol *s = parent; + return parent ? parent->pastMixin() : NULL; +} + +Dsymbol *Dsymbol::pastMixin() +{ + Dsymbol *s = this; while (s && s->isTemplateMixin()) s = s->parent; diff -uNr dmd-0.104/dmd/src/dmd/dsymbol.h dmd-0.105/dmd/src/dmd/dsymbol.h --- dmd-0.104/dmd/src/dmd/dsymbol.h 2004-10-03 16:22:02.000000000 +0200 +++ dmd-0.105/dmd/src/dmd/dsymbol.h 2004-10-27 20:14:04.000000000 +0200 @@ -90,6 +90,7 @@ void error(Loc loc, const char *format, ...); void error(const char *format, ...); Module *getModule(); + Dsymbol *pastMixin(); Dsymbol *toParent(); int dyncast() { return DYNCAST_DSYMBOL; } // kludge for template.isSymbol() diff -uNr dmd-0.104/dmd/src/dmd/expression.c dmd-0.105/dmd/src/dmd/expression.c --- dmd-0.104/dmd/src/dmd/expression.c 2004-10-03 17:25:34.000000000 +0200 +++ dmd-0.105/dmd/src/dmd/expression.c 2004-10-28 15:06:28.000000000 +0200 @@ -48,14 +48,18 @@ { FuncDeclaration *fd; FuncDeclaration *fdthis; + //printf("hasThis()\n"); fdthis = sc->parent->isFuncDeclaration(); + //printf("fdthis = %p, '%s'\n", fdthis, fdthis ? fdthis->toChars() : ""); // Go upwards until we find the enclosing member function fd = fdthis; while (1) { if (!fd) + { printf("test1\n"); goto Lno; + } if (!fd->isNested()) break; @@ -73,7 +77,9 @@ } if (!fd->isThis()) + { printf("test2 '%s'\n", fd->toChars()); goto Lno; + } assert(fd->vthis); return fd; @@ -621,7 +627,7 @@ { switch (t->ty) { - case Tbit: value &= 1; break; + case Tbit: value = (value != 0); break; case Tint8: value = (d_int8) value; break; case Tchar: case Tuns8: value = (d_uns8) value; break; @@ -2797,7 +2803,7 @@ ClassDeclaration *cd = NULL; if (sc->func) - cd = sc->func->parent->isClassDeclaration(); + cd = sc->func->toParent()->isClassDeclaration(); if (!cd || !cd->baseClass || !sc->func->isCtorDeclaration()) { error("super class constructor call must be in a constructor"); @@ -2832,10 +2838,12 @@ ClassDeclaration *cd = NULL; if (sc->func) - cd = sc->func->parent->isClassDeclaration(); + cd = sc->func->toParent()->isClassDeclaration(); if (!cd || !sc->func->isCtorDeclaration()) { error("class constructor call must be in a constructor"); + type = Type::terror; + return this; } else { @@ -4519,7 +4527,7 @@ #endif if (e1->op == TOKstring && e2->op == TOKstring) e = optimize(WANTvalue); - else if (e1->type-equals(e2->type) && + else if (e1->type->equals(e2->type) && (e1->type->toBasetype()->ty == Tarray || e1->type->toBasetype()->ty == Tsarray)) { @@ -4980,6 +4988,11 @@ error("array comparison type mismatch, %s vs %s", t1->next->toChars(), t2->next->toChars()); e = this; } + else if (t1->ty == Tstruct || t2->ty == Tstruct) + { + error("need member function opCmp() for struct %s to compare", t1->toChars()); + e = this; + } else e = this; return e; diff -uNr dmd-0.104/dmd/src/dmd/func.c dmd-0.105/dmd/src/dmd/func.c --- dmd-0.104/dmd/src/dmd/func.c 2004-10-02 16:37:34.000000000 +0200 +++ dmd-0.105/dmd/src/dmd/func.c 2004-10-27 20:34:28.000000000 +0200 @@ -1011,7 +1011,8 @@ { //printf("test4\n"); break; } - if (!s->parent || !s->parent->isTemplateInstance()) + if (!s->parent || + (!s->parent->isTemplateInstance())) { //printf("test5\n"); break; } diff -uNr dmd-0.104/dmd/src/dmd/idgen.c dmd-0.105/dmd/src/dmd/idgen.c --- dmd-0.104/dmd/src/dmd/idgen.c 2004-08-13 10:43:46.000000000 +0200 +++ dmd-0.105/dmd/src/dmd/idgen.c 2004-10-28 13:52:24.000000000 +0200 @@ -35,7 +35,7 @@ { "This", "this" }, { "ctor", "_ctor" }, { "dtor", "_dtor" }, - { "classInvariant", "_invariant" }, + { "classInvariant", "__invariant" }, { "unitTest", "_unitTest" }, { "staticCtor", "_staticCtor" }, { "staticDtor", "_staticDtor" }, diff -uNr dmd-0.104/dmd/src/dmd/lexer.c dmd-0.105/dmd/src/dmd/lexer.c --- dmd-0.104/dmd/src/dmd/lexer.c 2004-08-30 02:08:24.000000000 +0200 +++ dmd-0.105/dmd/src/dmd/lexer.c 2004-10-25 15:44:38.000000000 +0200 @@ -1525,7 +1525,9 @@ case FLAGS_decimal: if (n & 0x8000000000000000LL) + { error("signed integer overflow"); result = TOKuns64v; + } else if (n & 0xFFFFFFFF80000000LL) result = TOKint64v; else @@ -1540,9 +1542,17 @@ result = TOKuns32v; break; - case FLAGS_long: case FLAGS_decimal | FLAGS_long: if (n & 0x8000000000000000LL) + { error("signed integer overflow"); + result = TOKuns64v; + } + else + result = TOKint64v; + break; + + case FLAGS_long: + if (n & 0x8000000000000000LL) result = TOKuns64v; else result = TOKint64v; diff -uNr dmd-0.104/dmd/src/dmd/mars.c dmd-0.105/dmd/src/dmd/mars.c --- dmd-0.104/dmd/src/dmd/mars.c 2004-10-21 16:38:22.000000000 +0200 +++ dmd-0.105/dmd/src/dmd/mars.c 2004-10-29 12:06:58.000000000 +0200 @@ -11,11 +11,16 @@ #include #include #include +#include #if __DMC__ #include #endif +#if linux +#include +#endif + #include "mem.h" #include "root.h" @@ -44,7 +49,7 @@ copyright = "Copyright (c) 1999-2004 by Digital Mars"; written = "written by Walter Bright"; - version = "v0.104"; + version = "v0.105"; global.structalign = 8; memset(¶ms, 0, sizeof(Param)); @@ -275,12 +280,21 @@ if (p[6] == '=') { if (isdigit(p[7])) - DebugCondition::setGlobalLevel(atoi(p + 7)); + { long level; + + errno = 0; + level = strtol(p + 7, &p, 10); + if (*p || errno || level > INT_MAX) + goto Lerror; + DebugCondition::setGlobalLevel((int)level); + } else if (isalpha(p[7])) DebugCondition::addGlobalIdent(p + 7); else goto Lerror; } + else if (p[6]) + goto Lerror; else global.params.debuglevel = 1; } @@ -320,11 +334,11 @@ else { Lerror: - error("unrecognized switch '%s'",p); + error("unrecognized switch '%s'", argv[i]); continue; Lnoarg: - error("argument expected for switch '%s'",p); + error("argument expected for switch '%s'", argv[i]); continue; } } @@ -452,6 +466,15 @@ name = (char *)mem.malloc((ext - p) + 1); memcpy(name, p, ext - p); name[ext - p] = 0; // strip extension + + if (name[0] == 0 || + strcmp(name, "..") == 0 || + strcmp(name, ".") == 0) + { + Linvalid: + error("invalid file name '%s'", (char *)files.data[i]); + fatal(); + } } else { error("unrecognized file extension %s\n", ext); @@ -459,7 +482,11 @@ } } else - name = p; + { name = p; + if (!*name) + goto Linvalid; + } + id = new Identifier(name, 0); m = new Module((char *) files.data[i], id); modules.push(m); diff -uNr dmd-0.104/dmd/src/dmd/mtype.c dmd-0.105/dmd/src/dmd/mtype.c --- dmd-0.104/dmd/src/dmd/mtype.c 2004-09-20 00:42:24.000000000 +0200 +++ dmd-0.105/dmd/src/dmd/mtype.c 2004-10-25 21:37:14.000000000 +0200 @@ -2570,7 +2570,7 @@ if (v) { // It's not a type, it's an expression - if (v->isConst()) + if (v->isConst() && v->getExpInitializer()) { ExpInitializer *ei = v->getExpInitializer(); assert(ei); diff -uNr dmd-0.104/dmd/src/dmd/opover.c dmd-0.105/dmd/src/dmd/opover.c --- dmd-0.104/dmd/src/dmd/opover.c 2004-07-26 23:08:46.000000000 +0200 +++ dmd-0.105/dmd/src/dmd/opover.c 2004-10-25 22:18:54.000000000 +0200 @@ -234,6 +234,7 @@ * and see which is better. */ Expression *e; + FuncDeclaration *lastf; args1.setDim(1); args1.data[0] = (void*) e1; @@ -244,6 +245,7 @@ memset(&m, 0, sizeof(m)); m.last = MATCHnomatch; overloadResolveX(&m, fd, &args2); + lastf = m.lastf; overloadResolveX(&m, fd_r, &args1); if (m.count > 1) @@ -265,10 +267,10 @@ // Rewrite (e1 ++ e2) as e1.postinc() // Rewrite (e1 -- e2) as e1.postdec() e = build_overload(loc, sc, e1, NULL, id); - else if (m.lastf->ident == id) + else if (lastf && m.lastf == lastf || m.last == MATCHnomatch) // Rewrite (e1 op e2) as e1.opfunc(e2) e = build_overload(loc, sc, e1, e2, id); - else if (m.lastf->ident == id_r) + else // Rewrite (e1 op e2) as e2.opfunc_r(e1) e = build_overload(loc, sc, e2, e1, id_r); return e; @@ -293,6 +295,7 @@ * and see which is better. */ Expression *e; + FuncDeclaration *lastf; if (!argsset) { args1.setDim(1); @@ -304,6 +307,7 @@ memset(&m, 0, sizeof(m)); m.last = MATCHnomatch; overloadResolveX(&m, fd_r, &args2); + lastf = m.lastf; overloadResolveX(&m, fd, &args1); if (m.count > 1) @@ -318,12 +322,13 @@ { m.lastf = m.anyf; } - if (m.lastf->ident == id) - // Rewrite (e1 op e2) as e2.opfunc(e1) - e = build_overload(loc, sc, e2, e1, id); - else if (m.lastf->ident == id_r) + + if (lastf && m.lastf == lastf || m.last == MATCHnomatch) // Rewrite (e1 op e2) as e1.opfunc_r(e2) e = build_overload(loc, sc, e1, e2, id_r); + else + // Rewrite (e1 op e2) as e2.opfunc(e1) + e = build_overload(loc, sc, e2, e1, id); // When reversing operands of comparison operators, // need to reverse the sense of the op @@ -388,9 +393,10 @@ s = ad->search(funcid, 0); if (s) - { - s = s->toAlias(); - fd = s->isFuncDeclaration(); + { Dsymbol *s2; + + s2 = s->toAlias(); + fd = s2->isFuncDeclaration(); if (fd && fd->type->ty == Tfunction) return fd; diff -uNr dmd-0.104/dmd/src/dmd/parse.c dmd-0.105/dmd/src/dmd/parse.c --- dmd-0.104/dmd/src/dmd/parse.c 2004-08-30 02:11:28.000000000 +0200 +++ dmd-0.105/dmd/src/dmd/parse.c 2004-10-26 12:39:20.000000000 +0200 @@ -2454,7 +2454,7 @@ while (1) { Type *tb; - Identifier *ai; + Identifier *ai = NULL; Type *at; enum InOut inout; Argument *a; @@ -2466,6 +2466,8 @@ } tb = parseBasicType(); at = parseDeclarator(tb, &ai); + if (!ai) + error("no identifier for declarator"); a = new Argument(inout, at, ai, NULL); arguments->push(a); if (token.value == TOKcomma) diff -uNr dmd-0.104/dmd/src/dmd/root.c dmd-0.105/dmd/src/dmd/root.c --- dmd-0.104/dmd/src/dmd/root.c 2004-03-27 00:11:52.000000000 +0100 +++ dmd-0.105/dmd/src/dmd/root.c 2004-10-28 20:08:14.000000000 +0200 @@ -992,7 +992,7 @@ if (!ref) mem.free(buffer); ref = 2; - buffer = MapViewOfFileEx(hFileMap, FILE_MAP_READ,0,0,size,NULL); + buffer = (unsigned char *)MapViewOfFileEx(hFileMap, FILE_MAP_READ,0,0,size,NULL); if (CloseHandle(hFileMap) != TRUE) goto Lerr; if (buffer == NULL) // mapping view failed @@ -1713,7 +1713,7 @@ // Clear other bits in last word mask = (1 << (bitdim & 31)) - 1; if (mask) - data[allocdim - 1] &= ~mask; + data[allocdim - 1] &= mask; } void Bits::clear() diff -uNr dmd-0.104/dmd/src/dmd/statement.c dmd-0.105/dmd/src/dmd/statement.c --- dmd-0.104/dmd/src/dmd/statement.c 2004-09-16 03:02:46.000000000 +0200 +++ dmd-0.105/dmd/src/dmd/statement.c 2004-10-28 20:30:06.000000000 +0200 @@ -1703,10 +1703,19 @@ Statement *SynchronizedStatement::semantic(Scope *sc) { if (exp) - { + { ClassDeclaration *cd; + exp = exp->semantic(sc); - if (!exp->type->isClassHandle()) + cd = exp->type->isClassHandle(); + if (!cd) error("can only synchronize on class objects, not '%s'", exp->type->toChars()); + if (cd->isInterfaceDeclaration()) + { Type *t = new TypeIdentifier(0, Id::Object); + + t = t->semantic(0, sc); + exp = new CastExp(loc, exp, t); + exp = exp->semantic(sc); + } } body = body->semantic(sc); return this; diff -uNr dmd-0.104/dmd/src/dmd/template.c dmd-0.105/dmd/src/dmd/template.c --- dmd-0.104/dmd/src/dmd/template.c 2004-09-19 02:17:58.000000000 +0200 +++ dmd-0.105/dmd/src/dmd/template.c 2004-10-26 12:31:30.000000000 +0200 @@ -234,6 +234,7 @@ assert(dim >= ti->tiargs->dim); // Set up scope for parameters + assert(scope); ScopeDsymbol *paramsym = new ScopeDsymbol(); paramsym->parent = scope->parent; Scope *paramscope = scope->push(paramsym); @@ -1522,12 +1523,6 @@ else assert(tempdecl->isTemplateDeclaration()); - if (!tempdecl->scope) - { - error("forward reference to template"); - return NULL; - } - /* Since there can be multiple TemplateDeclaration's with the same * name, look for the best match. */ @@ -1548,6 +1543,11 @@ continue; dedtypes.setDim(td->parameters->dim); + if (!td->scope) + { + error("forward reference to template"); + return NULL; + } m = td->matchWithInstance(this, &dedtypes, 0); if (!m) // no match at all continue; diff -uNr dmd-0.104/dmd/src/dmd/todt.c dmd-0.105/dmd/src/dmd/todt.c --- dmd-0.104/dmd/src/dmd/todt.c 2004-08-09 17:49:20.000000000 +0200 +++ dmd-0.105/dmd/src/dmd/todt.c 2004-10-28 20:08:40.000000000 +0200 @@ -49,6 +49,7 @@ return NULL; } + dt_t *StructInitializer::toDt() { Array dts; @@ -102,6 +103,24 @@ { d = v->init->toDt(); } + else if (v->offset >= offset) + { + unsigned k; + unsigned offset2 = v->offset + v->type->size(); + // Make sure this field does not overlap any explicitly + // initialized field. + for (k = j + 1; 1; k++) + { + if (k == dts.dim) // didn't find any overlap + { v->type->toDt(&d); // provide default initializer + break; + } + VarDeclaration *v2 = (VarDeclaration *)ad->fields.data[k]; + + if (v2->offset < offset2 && dts.data[k]) + break; // overlap + } + } } if (d) { @@ -124,8 +143,10 @@ return dt; } + dt_t *ArrayInitializer::toDt() { + //printf("ArrayInitializer::toDt('%s')\n", toChars()); Type *tb = type->toBasetype(); Type *tn = tb->next->toBasetype(); @@ -170,7 +191,7 @@ if (dt) pdtend = dtcat(pdtend, dt); else - pdtend = dtnzeros(pdtend, size); + pdtend = tn->toDt(pdtend); } switch (tb->ty) { @@ -212,15 +233,39 @@ unsigned size; unsigned length; unsigned i; + unsigned tadim; dt_t *d; dt_t **pdtend; Type *tb = type->toBasetype(); + //printf("ArrayInitializer::toDtBit('%s')\n", toChars()); + Bits databits; Bits initbits; - databits.resize(dim); - initbits.resize(dim); + if (tb->ty == Tsarray) + { + /* The 'dim' for ArrayInitializer is only the maximum dimension + * seen in the initializer, not the type. So, for static arrays, + * use instead the dimension of the type in order + * to get the whole thing. + */ + integer_t value = ((TypeSArray*)tb)->dim->toInteger(); + tadim = value; + assert(tadim == value); // truncation overflow should already be checked + databits.resize(tadim); + initbits.resize(tadim); + } + else + { + databits.resize(dim); + initbits.resize(dim); + } + + /* The default initializer may be something other than zero. + */ + if (tb->next->defaultInit()->toInteger()) + databits.set(); size = sizeof(databits.data[0]); @@ -229,23 +274,28 @@ { Expression *idx; Initializer *val; Expression *eval; - unsigned bitval; idx = (Expression *)index.data[i]; if (idx) - length = idx->toInteger(); + { integer_t value; + value = idx->toInteger(); + length = value; + if (length != value) + { error("index overflow %llu", value); + length = 0; + } + } assert(length < dim); val = (Initializer *)value.data[i]; eval = val->toExpression(); - bitval = eval->toInteger(); if (initbits.test(length)) error("duplicate initializations for index %d", length); initbits.set(length); - if (bitval & 1) + if (eval->toInteger()) // any non-zero value is boolean 'true' databits.set(length); else - databits.clear(length); + databits.clear(length); // boolean 'false' length++; } @@ -254,10 +304,7 @@ switch (tb->ty) { case Tsarray: - { unsigned tadim; - TypeSArray *ta = (TypeSArray *)tb; - - tadim = ta->dim->toInteger(); + { if (dim > tadim) error("too many initializers %d for array[%d]", dim, tadim); else @@ -312,6 +359,7 @@ dt_t **IntegerExp::toDt(dt_t **pdt) { unsigned sz; + //printf("IntegerExp::toDt() %d\n", op); sz = type->size(); if (value == 0) pdt = dtnzeros(pdt, sz); @@ -634,23 +682,36 @@ dt_t **TypeSArray::toDt(dt_t **pdt) { int i; - int len; + unsigned len; len = dim->toInteger(); if (len) { while (*pdt) pdt = &((*pdt)->DTnext); - next->toDt(pdt); - if ((*pdt)->dt == DT_azeros && !(*pdt)->DTnext) + if (next->toBasetype()->ty == Tbit) { - (*pdt)->DTazeros *= len; + Bits databits; + + databits.resize(len); + if (next->defaultInit()->toInteger()) + databits.set(); + pdt = dtnbytes(pdt, databits.allocdim * sizeof(databits.data[0]), + (char *)databits.data); } else { - for (i = 1; i < len; i++) + next->toDt(pdt); + if ((*pdt)->dt == DT_azeros && !(*pdt)->DTnext) { - pdt = next->toDt(pdt); + (*pdt)->DTazeros *= len; + } + else + { + for (i = 1; i < len; i++) + { + pdt = next->toDt(pdt); + } } } } diff -uNr dmd-0.104/dmd/src/dmd/toobj.c dmd-0.105/dmd/src/dmd/toobj.c --- dmd-0.104/dmd/src/dmd/toobj.c 2004-10-04 20:04:24.000000000 +0200 +++ dmd-0.105/dmd/src/dmd/toobj.c 2004-10-28 15:11:28.000000000 +0200 @@ -816,10 +816,36 @@ dim = ((TypeSArray *)tb)->dim->toInteger(); - // Duplicate Sdt 'dim-1' times, as we already have the first one - while (--dim > 0) + if (tb->next->toBasetype()->ty == Tbit) + { integer_t value; + + value = ie->exp->toInteger(); + value = (value & 1) ? ~(integer_t)0 : (integer_t)0; + if (value == 0) + { + dtnzeros(&s->Sdt, ((unsigned)dim + 31) / 32 * 4); + } + else + { + while (dim >= 32) + { + dtnbytes(&s->Sdt, 4, (char *)&value); + dim -= 32; + } + if (dim) + { + value = (1 << dim) - 1; + dtnbytes(&s->Sdt, 4, (char *)&value); + } + } + } + else { - ie->exp->toDt(&s->Sdt); + // Duplicate Sdt 'dim-1' times, as we already have the first one + while (--dim > 0) + { + ie->exp->toDt(&s->Sdt); + } } } } diff -uNr dmd-0.104/dmd/src/dmd/typinf.c dmd-0.105/dmd/src/dmd/typinf.c --- dmd-0.104/dmd/src/dmd/typinf.c 2004-08-17 14:39:56.000000000 +0200 +++ dmd-0.105/dmd/src/dmd/typinf.c 2004-10-25 21:35:48.000000000 +0200 @@ -285,6 +285,7 @@ } t = Type::typeinfo->type->arrayOf(); + ai->type = t; v = new VarDeclaration(0, t, id, ai); m->members->push(v); m->symtab->insert(v); diff -uNr dmd-0.104/dmd/src/dmd/utf.c dmd-0.105/dmd/src/dmd/utf.c --- dmd-0.104/dmd/src/dmd/utf.c 2004-07-14 23:20:36.000000000 +0200 +++ dmd-0.105/dmd/src/dmd/utf.c 2004-10-28 20:15:14.000000000 +0200 @@ -172,6 +172,8 @@ { msg = "illegal UTF-16 value"; goto Lerr; } + else + i++; } else { diff -uNr dmd-0.104/dmd/src/phobos/internal/adi.d dmd-0.105/dmd/src/phobos/internal/adi.d --- dmd-0.104/dmd/src/phobos/internal/adi.d 2004-10-21 01:23:00.000000000 +0200 +++ dmd-0.105/dmd/src/phobos/internal/adi.d 2004-10-29 12:07:36.000000000 +0200 @@ -207,7 +207,7 @@ size = (a.length + 31) / 32; r.ptr = cast(void *) new uint[size]; r.length = a.length; - memcpy(r.ptr, a.ptr, size); + memcpy(r.ptr, a.ptr, size * uint.sizeof); return *cast(long*)(&r); } diff -uNr dmd-0.104/dmd/src/phobos/internal/gc/gc.d dmd-0.105/dmd/src/phobos/internal/gc/gc.d --- dmd-0.104/dmd/src/phobos/internal/gc/gc.d 2004-10-21 01:23:02.000000000 +0200 +++ dmd-0.105/dmd/src/phobos/internal/gc/gc.d 2004-10-29 12:07:38.000000000 +0200 @@ -405,7 +405,7 @@ px.data = newdata; } px.length = newlength; - px.data[length * size .. newlength * size] = y[]; + memcpy(px.data + length * size, y, y.length * size); return *cast(long*)px; } diff -uNr dmd-0.104/dmd/src/phobos/std/array.d dmd-0.105/dmd/src/phobos/std/array.d --- dmd-0.104/dmd/src/phobos/std/array.d 2004-10-21 01:22:58.000000000 +0200 +++ dmd-0.105/dmd/src/phobos/std/array.d 2004-10-29 12:07:36.000000000 +0200 @@ -16,9 +16,9 @@ this.filename = filename; char[] buffer = new char[19 + filename.length + linnum.sizeof * 3 + 1]; - int length; - length = sprintf(buffer, "ArrayBoundsError %.*s(%u)", filename, linnum); - super(buffer[0..length]); + int len; + len = sprintf(buffer, "ArrayBoundsError %.*s(%u)", filename, linnum); + super(buffer[0..len]); } } diff -uNr dmd-0.104/dmd/src/phobos/std/loader.d dmd-0.105/dmd/src/phobos/std/loader.d --- dmd-0.104/dmd/src/phobos/std/loader.d 2004-10-21 01:22:58.000000000 +0200 +++ dmd-0.105/dmd/src/phobos/std/loader.d 2004-10-29 12:07:36.000000000 +0200 @@ -93,7 +93,7 @@ alias HMODULE HModule_; } } -else version(Linux) +else version(linux) { extern(C) { @@ -282,7 +282,7 @@ return szFileName[0 .. cch].dup; } } -else version(Linux) +else version(linux) { private class ExeModuleInfo { diff -uNr dmd-0.104/dmd/src/phobos/std/switcherr.d dmd-0.105/dmd/src/phobos/std/switcherr.d --- dmd-0.104/dmd/src/phobos/std/switcherr.d 2004-10-21 01:22:58.000000000 +0200 +++ dmd-0.105/dmd/src/phobos/std/switcherr.d 2004-10-29 12:07:36.000000000 +0200 @@ -1,7 +1,9 @@ module std.switcherr; -class SwitchError : Object +import std.stdio; + +class SwitchError : Error { private: @@ -12,8 +14,13 @@ { this.linnum = linnum; this.filename = filename; + + char[] buffer = new char[17 + filename.length + linnum.sizeof * 3 + 1]; + int len = sprintf(buffer, "Switch Default %.*s(%u)", filename, linnum); + super(buffer[0..len]); } + public: /***************************************