Problem about using struct

Kenji Hara k.hara.pg at gmail.com
Mon Jun 25 03:10:55 PDT 2012


On Monday, 25 June 2012 at 06:05:34 UTC, Tongzhou Li wrote:
> Hello! I'm learning D, and wrote some sample codes with D.
> I wrote: http://ideone.com/VY7ES
>
> It failed to compile; I got 2 errors:
>     main.d(19): Error: constructor 
> main.carry!(int,int,int,int,int).carry.this (int delegate(int, 
> int _param_0, int _param_1, int _param_2) _f) is not callable 
> using argument types (int)
>     main.d(19): Error: cannot implicitly convert expression (1) 
> of type int to int delegate(int, int _param_0, int _param_1, 
> int _param_2)
> Compiler used: DMD v2.059 (I used lambda expression which 
> ideone doesn't support)
>
> Don't know what it means, I don't call any constructor in Line 
> 19. Then I tried to use "class" instead of "struct" 
> (http://ideone.com/ZI2Tn), it worked fine.
>
> So what's wrong with that?
> Sorry for my poor English:)

Unfortunately, this is a dmd bug that yet not fixed.
http://d.puremagic.com/issues/show_bug.cgi?id=6036

As far as I know, there is no workaround...

Kenji Hara


More information about the Digitalmars-d-learn mailing list