[Issue 3325] ICE(func.c) function literal with post-contract

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Sep 29 23:52:58 PDT 2009


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



--- Comment #8 from Don <clugdbug at yahoo.com.au> 2009-09-29 23:52:57 PDT ---
Here is a trivial patch to prevent the ICE, and turn it into a rejects-valid. 
That's probably enough for now -- the fact that it's taken years for this bug 
to be reported shows that it's pretty obscure.

func.c, FuncDeclaration::semantic3(), around line 995. 

    if (fensure || addPostInvariant())
    {   /* fensure is composed of the [out] contracts
         */
        ScopeDsymbol *sym = new ScopeDsymbol();
        sym->parent = sc2->scopesym;
        sc2 = sc2->push(sym);
+        if (!type->nextOf()) {
+         error("Postconditions are not supported if the return type is
inferred");
+         return;
+        }
        if (type->nextOf() && type->nextOf()->ty == Tvoid)
        {
        if (outId)
            error("void functions have no result");
        }

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