April 25, 2012
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: nobody@puremagic.com
        ReportedBy: samukha@voliacable.com


--- Comment #0 from Max Samukha <samukha@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: -------
February 05, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=7985


Maksim Zholudev <maximzms@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |maximzms@gmail.com
         Resolution|                            |DUPLICATE


--- Comment #1 from Maksim Zholudev <maximzms@gmail.com> 2013-02-05 07:53:51 PST ---
*** This issue has been marked as a duplicate of issue 6777 ***

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