[Issue 15307] New: Delegate with immutable and shared context do not convert to one another

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Nov 9 04:24:02 PST 2015


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

          Issue ID: 15307
           Summary: Delegate with immutable and shared context do not
                    convert to one another
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: jakobovrum at gmail.com

void main()
{
    immutable i = 42;
    auto dg = delegate void() immutable { auto inner = i; };
    void delegate() shared dg2 = dg; // Fails
}

---

This might be a useful conversion to have for non-templated functions like
std.concurrency.Scheduler.spawn (which currently does not enforce
shared/immutable context).

--


More information about the Digitalmars-d-bugs mailing list