http://d.puremagic.com/issues/show_bug.cgi?id=4543



--- Comment #12 from Iain Buclaw <ibuc...@ubuntu.com> 2011-03-24 12:41:02 PDT 
---
>--- a/src/class.c
>+++ b/src/class.c
>@@ -870,14 +870,14 @@ Dsymbol *ClassDeclaration::search(Loc loc, Identifier 
>*ident, int flags)
>     Dsymbol *s;
>     //printf("%s.ClassDeclaration::search('%s')\n", toChars(), 
> ident->toChars());
> 
>-    if (scope)
>+    if (scope && !symtab)
>     {   Scope *sc = scope;
>         sc->mustsemantic++;
>         semantic(sc);
>         sc->mustsemantic--;
>     }
> 
>-    if (!members || !symtab || scope)
>+    if (!members || !symtab)
>     {
>         error("is forward referenced when looking for '%s'", 
> ident->toChars());
>         //*(char*)0=0;

Here (and in StructDeclaration), if (!symtab) looks to be a sure sign that the
semantic pass hasn't been started yet. Also, if (!members), the semantic won't
run anyway, so you are in trouble even if you do call the semantic in the
search method.

Extending the condition instead to (scope && !symtab) is enough to fix/bypass
the forward reference errors for StructDeclaration's while not hurting bug282
which depends on the semantic being called. As for ClassDeclaration's,
something extra is needed (as you can see above), I'm not sure of the
importance of (scope) *needing* to be NULL here, but removing the check doesn't
seem to harm (at least) the testsuite.

Regards

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to