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

           Summary: implicit cast (implemented via alias this) is not
                    triggered when returning from function
           Product: D
           Version: 2.027
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: bugzi...@digitalmars.com
        ReportedBy: 2kor...@gmail.com


struct Proxy
{
        private Object o;

        Object get() { return o; }

        alias get this;
}

class Bar
{
        Object getObject()
        {
                //return _proxy; // should work, but doesn't

                Object o = _proxy;
                return o; // works but not like intended
        }

        private Proxy _proxy;
}

test.d(14): Error: cannot implicitly convert expression (this._proxy) of type
Proxy to object.Object


-- 

Reply via email to