From 8c7e196c3cb67a431ccaacf218cc49b04f989db2 Mon Sep 17 00:00:00 2001 From: David Nadlinger Date: Fri, 22 Apr 2011 14:44:56 +0200 Subject: [PATCH] Merged DMD commit 59d0f4b13384d656fdb66b2dc25c26e6b4cfa1ac: bugzilla 4768 Regression(1.056): wrong code with forward declaration of enum --- dmd/mtype.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/dmd/mtype.c b/dmd/mtype.c index 11101631..40f04a71 100644 --- a/dmd/mtype.c +++ b/dmd/mtype.c @@ -4294,6 +4294,18 @@ Expression *TypeEnum::defaultInit(Loc loc) int TypeEnum::isZeroInit(Loc loc) { + if (!sym->isdone && sym->scope) + { // Enum is forward referenced. We need to resolve the whole thing. + sym->semantic(NULL); + } + if (!sym->isdone) + { +#ifdef DEBUG + printf("3: "); +#endif + error(loc, "enum %s is forward referenced", sym->toChars()); + return 0; + } return (sym->defaultval == 0); }