[Issue 10922] New: Compiler segfaults when using __traits(parent, {})

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Aug 29 12:01:52 PDT 2013


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

           Summary: Compiler segfaults when using __traits(parent, {})
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: monkeyworks12 at hotmail.com


--- Comment #0 from monkeyworks12 at hotmail.com 2013-08-29 12:01:51 PDT ---
uint fib = (in uint n) pure nothrow {
    enum self = __traits(parent, {});
    return (n < 2) ? n : self(n - 1) + self(n - 2);
};

void main() 
{
    import std.stdio;

    writeln(fib(39));
}

This code causes a segfault, as does giving fib the auto storage class instead
of uint. If the code is changed to:

uint fib (in uint n) pure nothrow {
    immutable self = __traits(parent, {});
    return (n < 2) ? n : self(n - 1) + self(n - 2);
};

Then it does not segfault.

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