www.digitalmars.com         C & C++   DMDScript  

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

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: clugdbug yahoo.com.au


--- Comment #0 from Don <clugdbug 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: -------
Nov 11 2009
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3494


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |FIXED


--- Comment #1 from Walter Bright <bugzilla digitalmars.com> 2009-12-06
00:54:47 PST ---
Fixed dmd 2.037

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