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

          Issue ID: 17659
           Summary: `pure` causes function to be inferred as a delegate
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P1
         Component: dmd
          Assignee: nob...@puremagic.com
          Reporter: to...@weka.io

Consider the following

void indirectCall(T)(T fn) {
    pragma(msg, T);
}

__gshared int x;

void f() {
    indirectCall({x++;});      // void function() nothrow @nogc @system
}

void g() pure {
    indirectCall({x++;});     // pure delegate 'dtest.g.__lambda1' cannot
access mutable static data 'x'
}

please ignore the mutable state issue -- the issue here that `{x++}` is treated
as a function

--

Reply via email to