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

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