auto functions not authorized inside main?

2010-06-27 Thread Philippe Sigaud
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|unrecogni

Re: auto functions not authorized inside main?

2010-06-27 Thread bearophile
Philippe Sigaud: > I couldn't find a bugzilla entry for this and I cannot believe no one ever > tried to put an auto fun inside main! Maybe auto funcs are seen as instantiated templates, and templates can't be defined inside functions. Anyway, I think you can file this as enhancement request. B

Re: auto functions not authorized inside main?

2010-06-28 Thread Rory McGuire
On Sun, 27 Jun 2010 17:17:25 +0200, Philippe Sigaud wrote: 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, n

Re: auto functions not authorized inside main?

2010-06-28 Thread BCS
Hello Rory, On Sun, 27 Jun 2010 17:17:25 +0200, Philippe Sigaud wrote: void main() { auto fun(string s) { return s;} // this does not compile } Hope this isn't a stupid question, but how would you access this function if it did work? Would it be fun("asdf")? Is this just shorthand for: auto

Re: auto functions not authorized inside main?

2010-06-28 Thread Rory McGuire
On Mon, 28 Jun 2010 16:07:43 +0200, Philippe Sigaud wrote:On Mon, Jun 28, 2010 at 15:40, Rory McGuire wrote: void main() {    auto fun(string s) { return s;} // this does not compile } Hope this isn't a stupid question, but how would you access this function if it di

Re: auto functions not authorized inside main?

2010-06-28 Thread Rory McGuire
On Mon, 28 Jun 2010 16:01:46 +0200, BCS wrote: Hello Rory, On Sun, 27 Jun 2010 17:17:25 +0200, Philippe Sigaud wrote: void main() { auto fun(string s) { return s;} // this does not compile } Hope this isn't a stupid question, but how would you access this function if it did work? Would i