[Issue 6436] Refcounted initialization bug

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Aug 4 13:36:01 PDT 2011


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



--- Comment #1 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2011-08-04 13:36:01 PDT ---
Oh damnit duplicated code sorry:

import std.typecons;

struct Foo
{
    struct Payload
    {
        this(ref int bar, int value)
        { 
            bar = value;
            assert(bar == 5);   // ok
        }
    }

    alias RefCounted!(Payload, RefCountedAutoInitialize.yes) Data;
    Data data;

    int bar;

    this(int value) 
    {
        data = Data(bar, value);
        assert(bar == 5);  // throws, it's still 0
    }    
}

void main()
{
    auto foo = Foo(5);
}

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