[Issue 1204] New: segfault using struct in CTFE

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Apr 30 12:53:01 PDT 2007


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

           Summary: segfault using struct in CTFE
           Product: D
           Version: 1.013
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: clugdbug at yahoo.com.au


Seems to be a memory corruption problem. Doesn't happen if unused, unused2 are
removed.
---------
struct V {
    int a;
    int b;
}

V f()
{
    int q = 0;
    int unused;
    int unused2;
    return V(q, 0);
}

void main()
{
    const w = f();
}

==========================
Probably more helpful is this version, which prints:
No expression copy for: unused
just before it crashes.
------------------------
struct V {
    int a;
    int b;
}

V f()
{
    int q = 0;
    int unused;
    int unused2;
    return V(q, 0);
}

void main()
{
    const w = f().b;
}


-- 



More information about the Digitalmars-d-bugs mailing list