Mercurial > projects > ldc
diff dmd/func.c @ 35:3cfcb944304e trunk
[svn r39] * Updated to DMD 1.022 with the exception of:
Bugzilla 278: dmd.conf search path doesn't work
This fix was causing crashes for me :/ So for it's the old behaviour
author | lindquist |
---|---|
date | Tue, 09 Oct 2007 06:21:30 +0200 |
parents | 788401029ecf |
children | 6fcc08a4d406 |
line wrap: on
line diff
--- a/dmd/func.c Tue Oct 09 02:50:00 2007 +0200 +++ b/dmd/func.c Tue Oct 09 06:21:30 2007 +0200 @@ -929,12 +929,19 @@ * ctor consts were initialized. */ - ScopeDsymbol *ad = toParent()->isScopeDsymbol(); - assert(ad); - for (int i = 0; i < ad->members->dim; i++) - { Dsymbol *s = (Dsymbol *)ad->members->data[i]; - - s->checkCtorConstInit(); + Dsymbol *p = toParent(); + ScopeDsymbol *ad = p->isScopeDsymbol(); + if (!ad) + { + error("static constructor can only be member of struct/class/module, not %s %s", p->kind(), p->toChars()); + } + else + { + for (int i = 0; i < ad->members->dim; i++) + { Dsymbol *s = (Dsymbol *)ad->members->data[i]; + + s->checkCtorConstInit(); + } } } @@ -2249,7 +2256,7 @@ void StaticCtorDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs) { if (hgs->hdrgen) - { buf->writestring("static this(){}\n"); + { buf->writestring("static this();\n"); return; } buf->writestring("static this()");