May 23, 2008 [Issue 2122] New: Scope object from a mixin destroyed immediately | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=2122 Summary: Scope object from a mixin destroyed immediately Product: D Version: 2.013 Platform: PC OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla@digitalmars.com ReportedBy: bartosz@relisoft.com I create a scope object using a mixin. When I run the program, the scope object is destroyed immediately after construction, instead of at the end of the scope of instantiation. --------------- import std.stdio; import std.string; scope class Foo { this () { writeln ("Constructor"); } ~this () { writeln ("Destructor"); } } string ScopedVar () { return "scope Foo f = new Foo;\n"; } void main () { mixin (ScopedVar ()); writeln (" Inside Scope"); } ----Output---- c:\D\Work>test Constructor Destructor Inside Scope -- |
November 24, 2008 [Issue 2122] Scope object from a mixin destroyed immediately | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2122 smjg@iname.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |smjg@iname.com Status|NEW |RESOLVED Resolution| |WORKSFORME ------- Comment #1 from smjg@iname.com 2008-11-24 06:06 ------- Cannot reproduce in DMD 1.036 or 2.019. -- |
Copyright © 1999-2021 by the D Language Foundation