[Issue 2122] New: Scope object from a mixin destroyed immediately
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri May 23 10:25:56 PDT 2008
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 at digitalmars.com
ReportedBy: bartosz at 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
--
More information about the Digitalmars-d-bugs
mailing list