http://d.puremagic.com/issues/show_bug.cgi?id=8402



--- Comment #5 from Kenji Hara <k.hara...@gmail.com> 2012-08-04 10:11:15 PDT ---
(In reply to comment #0)
> The following code does not compile (x.d):
> 
> void main()
> {
>     auto fn = (int x = 0) => x + 1;
>     fn();
> }
> 
> with message: "x.d(4): Error: expected 1 function arguments, not 0"
> However, calling fn() with an explicit argument works fine as usual.

The function pointer `fn` is not a lambda itself, so cannot have default
argument.
If it is allowed:

    auto fn = (int x = 0) => x + 1;
    fn();   // returns 1

    fn = (int x = 1) => x + 1;
    fn();   // returns 1 or 2?

What is returned by the 2nd call of fn? I cannot imagine it.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to