[Issue 8545] defined opCast disables cast(void*)this in classes

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Aug 13 07:58:01 PDT 2012


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



--- Comment #3 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2012-08-13 07:57:58 PDT ---
(In reply to comment #2)
> I don't think this is major, because you can use a union:
> 
> {
>     static union U { Object o; void* p; }
>     U u;
>     u.o = this;
>     return u.p;
> }
> 
> In fact, because a union can be used for reinterpret casting, I don't think any
> new syntax or semantics are needed.

I'm speaking in terms of wrapping C++ libraries (A C++ wrapper class has an
inner d_object pointer which it uses to invoke D virtual methods). You're
asking me to introduce overhead for every time a new class object is
instantiated.

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


More information about the Digitalmars-d-bugs mailing list