why cannot spawn function defined in unittest block {}?
mw
mingwu at gmail.com
Sat Jun 20 18:08:06 UTC 2020
On Saturday, 20 June 2020 at 18:01:51 UTC, Adam D. Ruppe wrote:
> On Saturday, 20 June 2020 at 17:43:42 UTC, mw wrote:
>> the function defined in unittest become a delegate? how to
>> work-around this?
>
> just add the keyword static to the functions
https://github.com/mingwugmail/dlang_tour/blob/master/spawn_in_unittest.d#L50
Tried, still doesn't work:
$ dmd -unittest spawn_in_unittest.d
spawn_in_unittest.d(57): Error: static function
spawn_in_unittest.__unittest_L33_C1.threadProducer cannot access
frame of function spawn_in_unittest.__unittest_L33_C1
spawn_in_unittest.d(74): Error: static function
spawn_in_unittest.__unittest_L33_C1.threadConsumer cannot access
frame of function spawn_in_unittest.__unittest_L33_C1
More information about the Digitalmars-d-learn
mailing list