[Issue 20954] New: spawn in unitest: compiler error, confusing message

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jun 18 22:41:42 UTC 2020


https://issues.dlang.org/show_bug.cgi?id=20954

          Issue ID: 20954
           Summary: spawn in unitest: compiler error, confusing message
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: mingwu at gmail.com

Created attachment 1794
  --> https://issues.dlang.org/attachment.cgi?id=1794&action=edit
spawn in unitest: compiler error, confusing message

put the code from:

https://tour.dlang.org/tour/en/multithreading/synchronization-sharing

in file, and put unittest block from safePrint() to main()

as here:

https://github.com/mingwugmail/dlang_tour/blob/master/spawn_in_unittest.d#L33

$ dmd -unittest spawn_in_unittest.d
spawn_in_unittest.d(87): Error: template std.concurrency.spawn cannot deduce
function from argument types !()(void delegate(shared(SafeQueue!int) queue,
shared(int)* queueCounter) @system, shared(SafeQueue!int), shared(int)*),
candidates are:
/usr/include/dmd/phobos/std/concurrency.d(460):        spawn(F, T...)(F fn, T
args)
  with F = void delegate(shared(SafeQueue!int), shared(int)*) @system,
       T = (shared(SafeQueue!int), shared(int)*)
  must satisfy the following constraint:
       isSpawnable!(F, T)
spawn_in_unittest.d(88): Error: template std.concurrency.spawn cannot deduce
function from argument types !()(void delegate(Tid owner, shared(SafeQueue!int)
queue, shared(int)* queueCounter) @system, Tid, shared(SafeQueue!int),
shared(int)*), candidates are:
/usr/include/dmd/phobos/std/concurrency.d(460):        spawn(F, T...)(F fn, T
args)
  with F = void delegate(Tid, shared(SafeQueue!int), shared(int)*) @system,
       T = (Tid, shared(SafeQueue!int), shared(int)*)
  must satisfy the following constraint:
       isSpawnable!(F, T)

--


More information about the Digitalmars-d-bugs mailing list