www.digitalmars.com         C & C++   DMDScript  

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

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: clugdbug yahoo.com.au



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: -------
Nov 11 2011
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6933


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid



In these commits:

https://github.com/D-Programming-Language/dmd/commit/746d98fb0daacbd6a9efab1da6aacd2d7b55b39f

https://github.com/D-Programming-Language/dmd/commit/0051ed8ea86472083ed205a4857399d1f8defd71

it's mitigated from a segfault to an rejects-valid with line number.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 14 2011
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6933


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |FIXED



18:24:54 PST ---
https://github.com/D-Programming-Language/dmd/commit/51bc588d2e834650e5278247cd06b5da36569feb

https://github.com/D-Programming-Language/dmd/pull/602

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 04 2012