[Issue 2814] New: implicit cast (implemented via alias this) is not triggered when passing to function

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


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

           Summary: implicit cast (implemented via alias this) is not
                    triggered when passing to function
           Product: D
           Version: 2.027
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: 2korden at gmail.com


struct Proxy
{
        private Object o;

        Object get() { return o; }

        alias get this;
}

void foo(Object o)
{
}

void main()
{
        Proxy proxy;
        //foo(proxy); // should work, but doesn't

        Object o = proxy; // workaround
        foo(o);
}

test.d(17): Error: function test.foo (Object o) does not match parameter types
(
Proxy)
test.d(17): Error: cannot implicitly convert expression (proxy) of type Proxy
to
 object.Object


-- 



More information about the Digitalmars-d-bugs mailing list