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

           Summary: Segfault(mtype.c) using typeof(return) inside an auto
                    function
           Product: D
           Version: 2.036
          Platform: Other
        OS/Version: All
            Status: NEW
          Keywords: ice-on-invalid-code, patch
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: clugd...@yahoo.com.au


--- Comment #0 from Don <clugd...@yahoo.com.au> 2009-11-11 05:21:25 PST ---
TEST CASE:
---
auto foo()
{
    typeof(return) result;
    return result;
}
---

PATCH: TypeReturn::semantic(), mtype.c, line 5236

Type *TypeReturn::semantic(Loc loc, Scope *sc)
{
    Type *t;
    if (!sc->func)
    {    error(loc, "typeof(return) must be inside function");
    goto Lerr;
    }
    t = sc->func->type->nextOf();
+    if (!t)
+    {   error(loc, "typeof(return) cannot infer type");
+        goto Lerr;
+    }
    t = t->addMod(mod);

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

Reply via email to