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

           Summary: Impossible to cast interface/object reference to void*
                    in presence of 'alias this'
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: samu...@voliacable.com


--- Comment #0 from Max Samukha <samu...@voliacable.com> 2012-04-25 00:48:26 
PDT ---
struct S
{
}

interface I
{
    @property S foo();
    alias foo this;
}

class A
{
    @property S foo() {  return S(); }
    alias foo this;
}

void main()
{
    A a;
    I i;    
    auto ap = cast(void*)a;
    auto ip = cast(void*)i;   
}

Error: cannot cast from S to void*

It is easy to workaround for class objects by casting the reference to Object
first. Interfaces require more voodoo.

Can we just have a .ptr property on class/interface references?

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

Reply via email to