[Issue 3494] New: Segfault(mtype.c) using typeof(return) inside an auto function

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Nov 11 05:21:26 PST 2009


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: nobody at puremagic.com
        ReportedBy: clugdbug at yahoo.com.au


--- Comment #0 from Don <clugdbug at 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: -------


More information about the Digitalmars-d-bugs mailing list