Bug 7204 – [CTFE] Assertion failure when attempting to access function pointer of delegate

Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
All
Creation time
2012-01-02T12:40:00Z
Last change time
2013-10-05T22:58:05Z
Keywords
CTFE, ice
Assigned to
nobody
Creator
robert

Comments

Comment #0 by robert — 2012-01-02T12:40:18Z
---- auto foo() { void delegate() myDg; return myDg.funcptr; } enum _ = foo(); ---- This gives an assertion failure using dmd 2.057: Assertion failed: (IsStackValueValid(newval)), function createStackValue, file interpret.c, line 6262.
Comment #1 by lovelydear — 2012-04-19T12:31:59Z
Under 2.059 Win32, this won't compile: auto foo() { void delegate() myDg; return myDg.funcptr; } enum _ = foo(); void main() {} PS E:\DigitalMars\dmd2\samples> rdmd bug.d bug.d(4): Error: Cannot convert &void delegate() to void* at compile time bug.d(6): called from here: foo() If we write instead : enum _ = &foo; Everything looks fine.
Comment #2 by bugzilla — 2013-10-05T22:58:05Z
A correct error message is given by 2.064 head: test.d(4): Error: Cannot convert &void delegate() to void* at compile time test.d(6): called from here: foo()