It seems auto function cannot be inner functions: void foo() { string bar(string s) { return s;} // works auto baz(string s) { return s;} // error! } Errors: main.d|13|found 's' when expecting ')'| main.d|13|semicolon expected, not ')'| main.d|13|found ')' instead of statement| Reading the docs, nothing tells me auto functions cannot be used as inner function. So either it's a bug or you should update the docs.
Created attachment 686 [details] allow parsing inner auto functions
While skimming parser.c I noticed that the auto keyword is treated like a storage specifier, so this one is allowed: auto void bar() { } The spec says nothing about this case, but it seems nonsensical.
seems this is a duplicate of issue 3654
*** Issue 3654 has been marked as a duplicate of this issue. ***
*** Issue 5045 has been marked as a duplicate of this issue. ***
For newer DMD versions, the error messages seems to have moved a level higher: »function declaration without return type. (Note that constructors are always named 'this')«
*** Issue 6903 has been marked as a duplicate of this issue. ***
D2 Patch: https://github.com/D-Programming-Language/dmd/pull/500
https://github.com/D-Programming-Language/dmd/commit/9f6e32ec88f4137b5030785813cd7b20c94831d5