[Issue 6969] Forward reference on template class triangle

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Dec 6 16:57:36 PST 2011


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



--- Comment #2 from Nick Sabalausky <cbkbbejeap at mailinator.com> 2011-12-06 16:57:34 PST ---
I'm not very familiar with DMD's internals wrt semantics, but from what I can
tell so far, the problem may have to do with a certain section near the end of
TemplateInstance::semantic(Scope *sc, Expressions *fargs):

...
    /* The problem is when to parse the initializer for a variable.
     * Perhaps VarDeclaration::semantic() should do it like it does
     * for initializers inside a function.
     */
//    if (sc->parent->isFuncDeclaration())

        /* BUG 782: this has problems if the classes this depends on
         * are forward referenced. Find a way to defer semantic()
         * on this template.
         */
        semantic2(sc2);
...

That call to semantic2 is the call stack when the "has forward references"
error is thrown. Note that this occurs before tryMain() reaches semantic2.

Do to my inexperience with DMD's internals, I have no idea if there's some
reason that call to semantic2 is supposed to be there. And I don't understand
what those comments are trying to say. But if I comment out that semantic2
call, the test case passes. However, I don't know whether that breaks anything
else.

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


More information about the Digitalmars-d-bugs mailing list