[Issue 6933] New: Segfault(declaration.c) using struct with destructor in CTFE

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Nov 11 17:32:49 PST 2011


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

           Summary: Segfault(declaration.c) using struct with destructor
                    in CTFE
           Product: D
           Version: D1 & D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: clugdbug at yahoo.com.au


--- Comment #0 from Don <clugdbug at yahoo.com.au> 2011-11-11 17:32:08 PST ---
struct Bug6933 {
    int x = 3;
    ~this()     {  }
}

int test6933() {
    Bug6933 q;
    return 3;
}

static assert(test6933());

It's because interpret.c, getVarExp calls StructLiteralExp::semantic with NULL
scope. semantic sees there's a destructor, and converts it into:
(Bug7973 __tmp = Bug6973(), __tmp). This crashes because __tmp is a variable
with no scope. I don't understand why it does that transformation, it seems to
me to be in the wrong place.

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