https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113758
Bug ID: 113758 Summary: d: Callee destructor call invalidates the live object, not the temporary Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: d Assignee: ibuclaw at gdcproject dot org Reporter: ibuclaw at gdcproject dot org Target Milestone: --- D ABI does callee destruction of arguments, which depends on the argument already being copied to a temporary before passing by ref. At some point, the front-end stopped explicitly generating this temporary, so now the code generator must take care of it. --- struct Sdtor { int field; ~this() { field = 0; } } void main() { auto var = Sdtor(1); callee(var); assert(var.field == 1); // fails. } void callee(Sdtor param) { }