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

--- Comment #0 from Max Samukha <> 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:
------- You are receiving this mail because: -------

Reply via email to