Bug 5959 – Return by reference with nested function should be allowed

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-05-08T12:06:00Z
Last change time
2011-09-24T05:36:01Z
Keywords
rejects-valid
Assigned to
nobody
Creator
k.hara.pg

Comments

Comment #0 by k.hara.pg — 2011-05-08T12:06:04Z
Define nested ref function is not allowed with current dmd, but should be. ---- int n; void main() { ref int f(){ return n; } // NG // nothrow ref int f(){ return n; } // OK // auto ref int f(){ return n; } // OK f() = 1; assert(n == 1); ---- See parse.c, calling route parseDeclDefs -> parseDeclaration changed with dmd 2.020(Fixing issue 2345), but did not changed parseStatement -> parseDeclaration from git brame. It seems to me that this is a parser problem.
Comment #1 by bugzilla — 2011-06-04T23:52:40Z
Comment #2 by yebblies — 2011-06-06T21:28:24Z
*** Issue 2509 has been marked as a duplicate of this issue. ***
Comment #3 by k.hara.pg — 2011-09-24T05:36:01Z
Already fixed, but not marked.