[Issue 21737] New: shared opApply does not compile

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Mar 20 00:10:47 UTC 2021


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

          Issue ID: 21737
           Summary: shared opApply does not compile
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: iamthewilsonator at hotmail.com

struct Foo
{
    int opApply( int delegate(size_t, int) shared scope) shared
    {
        return 0;
    }
}
void main()
{
    shared Foo foo;
    foreach(i, e; foo)
    {

    }
}

test.d(11): Error: function `test.opApply(int delegate(ulong, int) shared scope
_param_0) shared` is not callable using argument types `(int delegate(ulong i,
int e) pure nothrow @nogc @safe) shared`
test.d(11):        cannot pass argument `__foreachbody2` of type `int
delegate(ulong i, int e) pure nothrow @nogc @safe` to parameter `int
delegate(ulong, int) shared scope _param_0`

expected: no error

--


More information about the Digitalmars-d-bugs mailing list