Comment #0 by philippe.sigaud — 2010-06-28T07:07:11Z
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.
Comment #1 by ellery-newcomer — 2010-06-28T21:32:58Z
Created attachment 686
allow parsing inner auto functions
Comment #2 by leopold_walkling — 2010-06-30T12:58:50Z
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.
Comment #3 by ellery-newcomer — 2010-07-01T09:10:51Z
seems this is a duplicate of issue 3654
Comment #4 by bearophile_hugs — 2010-07-01T09:34:46Z
*** Issue 3654 has been marked as a duplicate of this issue. ***
Comment #5 by code — 2011-07-30T15:35:55Z
*** Issue 5045 has been marked as a duplicate of this issue. ***
Comment #6 by code — 2011-07-30T15:37:38Z
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')«
Comment #7 by k.hara.pg — 2011-11-07T09:54:21Z
*** Issue 6903 has been marked as a duplicate of this issue. ***