One of my projects started mysteriously throwing segfaults. I managed to narrow it down to a line in one of my interface's out contracts that compared the result with a value returned by a property method defined on the interface. Even doing `debug stderr.writeln(this);` threw a segfault; GDB says its from the `_d_interface_cast` function. The full code is too big to post here, but I think I narrowed it down: import std.stdio; interface A { int* aField() @property pure; int foo() out(v) { debug stderr.writeln(this.aField); } } class F : A{ this() {} int myField; int* aField() @property pure { return &myField; } int foo() { debug stderr.writeln(this.aField); return 0; } } void main() { auto f = new F(); f.foo(); } I expect that this function would print the same address twice; it prints out `aField`, a simple function that returns a pointer to a class member, once in a function body and once in the interface's out contract. Running it with `rdmd -debug test.d` results in the following output: 7F21F379F010 6 The first address differs with each run (as expected with memory addresses) but the second line is consistently a 6. Moving the out contract to the implementation of foo method in class F results in the correct output (the same address printed twice). I suspect that the pointer adjustment that happens with `this` in an out contract is being done incorrectly, but I don't have the skills to diagnose it further. Using dmd v2.069.1 on x64 XUbuntu
This sounds like #14779. Do you want to grab master from git and test whether that fixes your error?
Issue 14779, for it to get linkified properly, I think.
Still happens on DMD 2.069.2. I haven't gotten around to downloading master and compiling it yet; I don't know if I'll have time for that.
It's a dup of issue 7517. PR#4794 for that also fixes it. https://github.com/D-Programming-Language/dmd/pull/4794 *** This issue has been marked as a duplicate of issue 7517 ***