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

           Summary: postblit not called for locals initialized from ref
                    functions
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: critical
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: samu...@voliacable.com


--- Comment #0 from Max Samukha <samu...@voliacable.com> 2011-03-15 01:54:18 
PDT ---
struct S
{
    static int destroyed;
    static int copied;

    this(this)
    {
        copied++;
    }

    ~this()
    {
        destroyed++;
    }
}

S s;

ref S foo()
{    
    return s;
}

void main()
{
    {
        auto s2 = foo();        
    }

    assert(S.copied == 1); // fail, s2 was not copied;
    assert(S.destroyed == 1); // ok, s2 was destroyed    
}

The destructor is called on s2, though s2 has not been postblit(ted?).
Maybe the same as other struct lifetime bugs.

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

Reply via email to