delegate as memeber

Timon Gehr timon.gehr at gmx.ch
Wed Feb 22 05:11:38 PST 2012


On 02/21/2012 04:24 PM, deadalnix wrote:
> struct stuff {
> private Exception delegate() exceptionBuilder = delegate Exception() {
> return new Exception("foobar");
> };
> }
>
> The following piece of code trigger a compiler error : delegate
> module.stuff.__dgliteral1 function literals cannot be class members
>
> Why is that ? Is it a bug or a feature ?

Bug or not, It is an annoying limitation.


More information about the Digitalmars-d-learn mailing list