auto functions not authorized inside main?

Philippe Sigaud philippe.sigaud at gmail.com
Sun Jun 27 08:17:25 PDT 2010


Is it defined somewhere that auto functions are not authorized inside main?

void main()
{
    auto fun(string s) { return s;} // this does not compile
}

error:

main.d|6|found 's' when expecting ')'|
main.d|6|semicolon expected, not ')'|
main.d|6|found ')' instead of statement|
main.d|7|unrecognized declaration|
||=== Build finished: 4 errors, 0 warnings ===|


So it's not even parsed?

I couldn't find a bugzilla entry for this and I cannot believe no one ever
tried to put an auto fun inside main!

Is that part of the spec?

Philippe


More information about the Digitalmars-d-learn mailing list