digitalmars.D.bugs - [Issue 24368] New: destruction of parameter should be done by caller
- d-bugmail puremagic.com (30/30) Feb 03 https://issues.dlang.org/show_bug.cgi?id=24368
https://issues.dlang.org/show_bug.cgi?id=24368 Issue ID: 24368 Summary: destruction of parameter should be done by caller Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: bugzilla digitalmars.com Consider: struct TT { int a; ~this(); } void testtt(TT tt) /* tt is actually passed by ref */ { tt.a = 40; /* tt is destructed here, g++ destructs it in caller */ } void foot() { TT t; t.a = 3; testtt(t); /* a copy of t is made here, and passed by ref */ /* g++ destructs copy here */ } What dmd is doing is not wrong, it just is not what g++ is doing. I do not know why this is not showing up as a bug at least with g++ ABI compatibility. --
Feb 03