Bug 12209 – Unable to take address of function nested function

Status
RESOLVED
Resolution
WONTFIX
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-02-19T19:58:00Z
Last change time
2015-01-27T11:38:19Z
Assigned to
nobody
Creator
lt.infiltrator

Comments

Comment #0 by lt.infiltrator — 2014-02-19T19:58:53Z
---------------------------------------------------------- import std.functional : curry; class S { this(S delegate()) { } } void main() { S fun(int foo) { auto ret = new S(&curry!(gun, foo)); return ret; } S gun(int foo) { auto ret = new S(&curry!(fun, foo)); return ret; }; } --------------------------------------------------------- Fails to compile: /d607/f459.d(9): Error: undefined identifier gun, did you mean function fun? /d607/f459.d(9): Error: no constructor for S
Comment #1 by lt.infiltrator — 2015-01-23T14:01:18Z
Bug still exists with 2.065.
Comment #2 by dlang-bugzilla — 2015-01-23T14:08:09Z
Simpler test case: void main() { gun(); void gun() {} } The problem is that gun is forward-referenced, which is not allowed inside functions, and IIRC Walter said never will.
Comment #3 by lt.infiltrator — 2015-01-27T11:38:19Z
Fair enough, then.