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.
https://github.com/D-Programming-Language/dmd/commit/508ef9681683bad67e4b8516945b974f3716a56b
*** Issue 2509 has been marked as a duplicate of this issue. ***
Already fixed, but not marked.