Re: lambdas and function literals in classes

2013-07-09 Thread Timon Gehr
On 07/09/2013 02:32 PM, Artur Skawina wrote: IIRC this issue is already reported somewhere in bugzilla. http://d.puremagic.com/issues/show_bug.cgi?id=7653

Re: lambdas and function literals in classes

2013-07-09 Thread Dicebot
On Tuesday, 9 July 2013 at 12:32:55 UTC, Artur Skawina wrote: On 07/09/13 12:50, John Colvin wrote: JS asked about this in the main group, but here is more appropriate and I'm quite interested myself. Function/delegate *literals* in aggregates are not accepted by the compiler. Probably call

Re: lambdas and function literals in classes

2013-07-09 Thread Artur Skawina
On 07/09/13 12:50, John Colvin wrote: > JS asked about this in the main group, but here is more appropriate and I'm > quite interested myself. Function/delegate *literals* in aggregates are not accepted by the compiler. It's just a compiler issue; iirc the frontend recently got a bit smarter abou

Re: lambdas and function literals in classes

2013-07-09 Thread Dicebot
On Tuesday, 9 July 2013 at 11:16:39 UTC, bearophile wrote: So is it worth adding this diagnostic bug report in Bugzilla? ... I think yes. It should either just work or provide error message that actually explains the reasoning. Probably Don can clarify this as static initialization of a fie

Re: lambdas and function literals in classes

2013-07-09 Thread bearophile
Dicebot: So this has something to do with _initialization_ of class members with delegates/lambdas, not their very existence. So is it worth adding this diagnostic bug report in Bugzilla? class Foo { void delegate() dg1; void delegate() dg2 = delegate(){}; this() { this.

Re: lambdas and function literals in classes

2013-07-09 Thread Dicebot
On Tuesday, 9 July 2013 at 10:50:02 UTC, John Colvin wrote: JS asked about this in the main group, but here is more appropriate and I'm quite interested myself. Can someone explain the rationale behind this: class A { auto a = (){}; //Lambda not allowed auto b = function()

lambdas and function literals in classes

2013-07-09 Thread John Colvin
JS asked about this in the main group, but here is more appropriate and I'm quite interested myself. Can someone explain the rationale behind this: class A { auto a = (){}; //Lambda not allowed auto b = function(){}; //Function allowed auto c = delegate(){}; /