Issue 14138 - std.parallelism.task breaks @safety
Summary: std.parallelism.task breaks @safety
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: x86_64 Linux
: P2 major
Assignee: No Owner
URL:
Keywords: pull, safe
Depends on:
Blocks:
 
Reported: 2015-02-07 01:38 UTC by David Nadlinger
Modified: 2024-07-28 22:45 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description David Nadlinger 2015-02-07 01:38:41 UTC
---
struct Oops {
    int convert() {
        *cast(int*)0xcafebabe = 0xdeadbeef;
        return 0;
    }
    alias convert this;
}

void main() @safe {
    import std.parallelism;
    
    static void foo(int) @safe {}

    auto t = task(&foo, Oops.init);
    // or: auto t = scopedTask(&foo, Oops.init);

    taskPool.put(t);
}
---

Tested with current Git master (4de96a06, to-be 2.067), but looks like the issues has been present since the initial merge of std.parallelism.

Again a case of @trusted used on a template function without sufficient constraints.
Comment 1 Dlang Bot 2024-07-28 11:14:43 UTC
@ntrel created dlang/phobos pull request #9033 "Fix Bugzilla 14138 - std.parallelism.task breaks @safety" fixing this issue:

- Fix Bugzilla 14138 - std.parallelism.task breaks @safety

https://github.com/dlang/phobos/pull/9033
Comment 2 Dlang Bot 2024-07-28 22:45:46 UTC
dlang/phobos pull request #9033 "Fix Bugzilla 14138 - std.parallelism.task breaks @safety" was merged into master:

- 1ca9f47d105267d5b4366f8c5fb5ec4055f4acfd by Nick Treleaven:
  Fix Bugzilla 14138 - std.parallelism.task breaks @safety

https://github.com/dlang/phobos/pull/9033