The following code segfaults dmd 2.081.0:
struct List {
private List* l;
this(int x) {
l = &this;
}
}
List ls = 0;
void main() {
}
$ dmd --version
DMD64 D Compiler v2.081.0
[...]
$ dmd deneme.d
Segmentation fault <-- HERE
Forum discussion:
https://forum.dlang.org/post/[email protected]
Comment #1 by b2.temp — 2018-07-18T11:16:43Z
"List l = 0;" is done at compile time. This shouldn't be allowed since there's a pointer operation. put "writeln(&this);" in the ctor to see an evidence.
Comment #2 by uplink.coder — 2018-07-19T12:56:53Z
You are correct what happens here is infinite recursion inside the interpreter.
I am going to investigate.
Comment #3 by uplink.coder — 2018-07-19T12:57:57Z
You are correct what happens here is infinite recursion inside the interpreter.
I am going to investigate.
Comment #4 by b2.temp — 2020-06-21T02:54:12Z
no ICE anymore when using latest release or latest master