Bug 9735 – Casting delegates to void* should be illegal
Status
RESOLVED
Resolution
FIXED
Severity
minor
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-03-16T03:30:00Z
Last change time
2013-03-16T06:32:30Z
Keywords
accepts-invalid
Assigned to
nobody
Creator
code
Comments
Comment #0 by code — 2013-03-16T03:30:03Z
As per http://forum.dlang.org/post/[email protected], the following snippet should not compile:
---
void* delegateToPtr(void delegate() dg) {
return cast(void*)dg;
}
---
DMD currently returns the delegate context pointer.
As I couldn't find any justification for this in the spec, I marked the issue as an »accepts-invalid« bug, but feel free to downgrade it to an enhancement request.