[Issue 2813] New: implicit cast (implemented via alias this) is not triggered when returning from function

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Apr 6 13:18:59 PDT 2009


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: bugzilla at digitalmars.com
        ReportedBy: 2korden at 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


-- 



More information about the Digitalmars-d-bugs mailing list