[Issue 10194] New: std.variant.Variant doesn't call the dtor of struct values

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue May 28 07:50:26 PDT 2013


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

           Summary: std.variant.Variant doesn't call the dtor of struct
                    values
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: code at dawg.eu


--- Comment #0 from Martin Nowak <code at dawg.eu> 2013-05-28 07:50:25 PDT ---
Failing test case
----
import std.variant;

unittest
{
    static struct S
    {
        ~this()
        {
            ++cnt;
        }
        static size_t cnt;
    }

    Variant v;
    // assigning a new value should destroy the existing one
    {
        v = S();
        immutable n = S.cnt;
        v = 0;
        assert(S.cnt == n + 1);
    }
    // destroying the variant should destroy it's current value
    {
        v = S();
        immutable n = S.cnt;
        destroy(v);
        assert(S.cnt == n + 1);
    }
}

-- 
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