http://d.puremagic.com/issues/show_bug.cgi?id=11351
Summary: Destructor of "with" statement expression result is called too soon Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nob...@puremagic.com ReportedBy: thecybersha...@gmail.com --- Comment #0 from Vladimir Panteleev <thecybersha...@gmail.com> 2013-10-25 15:05:12 EEST --- import std.stdio; struct S { this(this) { writeln("this(this)"); } ~this() { writeln("~this()"); } } S makeS() { return S(); } void main() { writeln("before"); with (makeS()) { writeln("inside"); } writeln("after"); } ------------------------------------------- This program currently prints: before ~this() inside after This indicates that the S temporary inside the "with" block is already destroyed (and no copy is made). Fixing this would allow using "with" together with scope statements, as proposed here: http://forum.dlang.org/post/l4ccb4$25ul$1...@digitalmars.com -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------