[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
Mon Jun 6 06:22:48 PDT 2011


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


Don <clugdbug at yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch
                 CC|                            |clugdbug at yahoo.com.au
            Summary|DMD Segfault when           |Regression(2.050): Segfault
                   |forward-referencing pure    |when forward-referencing
                   |auto-return member function |pure auto-return member
                   |with parameter.             |function with parameter.


--- Comment #1 from Don <clugdbug at yahoo.com.au> 2011-06-06 06:18:17 PDT ---
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;
        }

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