[Issue 4869] auto return + inheritance + modules = compiler crashes(toctype.c)

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Sep 14 23:58:16 PDT 2010


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



--- Comment #3 from Don <clugdbug at yahoo.com.au> 2010-09-14 23:57:45 PDT ---
This is happening because semantic3() isn't run on the base class function.
Bug 3602 has a similar root cause.

A workaround is to use the function in module b.d. This forces semantic3 to be
run on 'fun'.
void workaround(Derived d)
{
   auto k = d.fun();
}


Mitigation patch (turns it into rejects-valid):
---------
tocsym.c, line 349, FuncDeclaration::toSymbol()

        s = symbol_calloc(id);
        slist_add(s);
+        // Ensure function has a return value
+        if (type->ty == Tfunction && !((TypeFunction *)type)->next)
+        {
+            error("Internal Compiler Error. See Bugzilla 4869.");
+            // Prevent a later crash
+            ((TypeFunction *)type)->next = Type::tint32;
+        }
        {
            s->prettyIdent = toPrettyChars();
            s->Sclass = SCglobal;
            symbol_func(s);

-- 
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