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



--- Comment #2 from Max Samukha <samu...@voliacable.com> 2010-12-23 03:51:52 
PST ---
(In reply to comment #1)
> It works with DMD 2.051 if I replace this line of the main():
> IFactory f = new A;
> 
> With:
> A f = new A;

We still need the implicit cast to work correctly. For example, we cannot pass
an A to a function taking an IFactory:

void bar(IFactory f)
{
    f.foo(); // segfault
} 

auto a = new A;
bar(a);

Here is a simplified test-case:

class B
{
}

class A
{

    B _b;

    this()
    {
        _b = new B;
    }

    B b()
    {
        return _b;        
    }   

    alias b this;
}

void main()
{

    auto a = new A;
    B b = a; // b is null
    assert(a._b is b); // fails 
}

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

Reply via email to