[Issue 7985] New: Impossible to cast interface/object reference to void* in presence of 'alias this'
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Apr 25 00:47:24 PDT 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 at puremagic.com
ReportedBy: samukha at voliacable.com
--- Comment #0 from Max Samukha <samukha at 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: -------
More information about the Digitalmars-d-bugs
mailing list