Classes or stucts :: Newbie

Andrej Mitrovic andrej.mitrovich at gmail.com
Sun Dec 19 12:51:44 PST 2010


On 12/19/10, bearophile <bearophileHUGS at lycos.com> wrote:
>> See the std.conv.emplace,
>
> Sorry, see std.typecons.scoped and its problems:
> http://d.puremagic.com/issues/show_bug.cgi?id=5115
>
> Bye,
> bearophile
>

Is this another bug?:

import std.stdio;
import std.typecons;

class A
{
    ~this()
    {
        writeln("dtor");
    }
}

void main()
{
    {
        A a1 = scoped!A();       // doesn't call dtor after the scope
        auto a2 = scoped!A();  // calls dtor after the scope
    }
}


More information about the Digitalmars-d-learn mailing list