[Issue 5115] std.typecons.scoped problems

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Dec 19 13:07:55 PST 2010


http://d.puremagic.com/issues/show_bug.cgi?id=5115



--- Comment #1 from bearophile_hugs at eml.cc 2010-12-19 13:06:00 PST ---
An interesting example found by Andrej Mitrovic (modified):


import std.c.stdio: puts;
import std.typecons: scoped;
class Foo {
    ~this() {
        puts("Foo.dtor");
    }
}
void main() {
    Foo f1 = scoped!Foo();  // doesn't call dtor after the scope
    auto f2 = scoped!Foo(); // calls dtor after the scope
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list