www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20873] New: std.parallelism.task mistakenly trusts

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: nobody puremagic.com
          Reporter: pro.mathias.lang 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.

--
May 28