Function pointers/delegates default args were stealth removed?

Jacob Carlborg doob at me.com
Tue Aug 28 00:54:39 PDT 2012


On 2012-08-28 09:16, Walter Bright wrote:

> I don't know what you mean.

The original problem in the bug report looked like this:

void main ()
{
     auto foo = (int a = 1) { return a; };
     auto bar = (int a) { return a; };

     writeln(foo());
     writeln(bar());
}

If I change one of the bodies of the anonymous functions to look like this:

void main ()
{
     auto foo = (int a = 1) { return a; writeln("foo"); };
     auto bar = (int a) { return a; };

     writeln(foo());
     writeln(bar());
}

It behaves correctly and won't compile any more.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list