http://d.puremagic.com/issues/show_bug.cgi?id=8545
Summary: defined opCast disables cast(void*)this in classes Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: major Priority: P2 Component: DMD AssignedTo: nob...@puremagic.com ReportedBy: andrej.mitrov...@gmail.com --- Comment #0 from Andrej Mitrovic <andrej.mitrov...@gmail.com> 2012-08-12 20:33:46 PDT --- class Foo { T opCast(T : int)() { return 1; } void* test() { return cast(void*)this; } } void main() { } This is problematic, cast(void*)this is the trick used to get the address of 'this' object. &this is the address of the reference and can't be used for the same purpose. So defining opCast for any type ends up disabling 'cast(void*)this'. I honestly think we should have a druntime function or some kind of compiler intrinsic to get the equivalent of 'cast(void*)this'. That cast itself looks too hacky to begin with. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------