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

          Issue ID: 20873
           Summary: std.parallelism.task mistakenly trusts user-supplied
                    implicit-conversion routines
           Product: D
           Version: D2
          Hardware: x86
                OS: Mac OS X
            Status: NEW
          Keywords: safe
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nob...@puremagic.com
          Reporter: pro.mathias.l...@gmail.com

```
import std.parallelism;

void myTask (int a) @safe {}
struct Deceptive
{
    public int deception () @system
    {
        int* ptr = cast(int*) 42;
        return *ptr;
    }
    alias deception this;
}

void main () @safe
{
    Deceptive d;
    auto t = task(&myTask, d);
    taskPool.put(t);
    t.spinForce();
}
```

Compiles and crash with DIP1000.

--

Reply via email to