Bug 6933 – Segfault(declaration.c) using struct with destructor in CTFE
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2011-11-11T17:32:00Z
Last change time
2015-06-09T05:10:43Z
Keywords
rejects-valid
Assigned to
nobody
Creator
clugdbug
Comments
Comment #0 by clugdbug — 2011-11-11T17:32:08Z
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.