[Issue 5936] Regression(2.050): Segfault when forward-referencing pure auto-return member function with parameter.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jun 30 11:32:03 PDT 2011


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



--- Comment #3 from kennytm at gmail.com 2011-06-30 11:27:04 PDT ---
(In reply to comment #1)
> The segfault is a simple null pointer dereference which can easily be patched.
> 
> mtype.c, TypeFunction::parameterEscapes, line 5369
> 
>     if (purity)
>     {   /* With pure functions, we need only be concerned if p escapes
>          * via any return statement.
>          */
> -        Type* tret = nextOf()->toBasetype();
> -        if (!isref && !tret->hasPointers())
> +        Type* tret = nextOf() ? nextOf()->toBasetype() : NULL;
> +        if (!isref && tret && !tret->hasPointers())
>         {   /* The result has no references, so p could not be escaping
>              * that way.
>              */
>             return FALSE;
>         }

This patch only fixes 5844. In git master this becomes

   Internal error: toir.c 190

with or without your patch.

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