Issue 21737 - shared opApply does not compile
Summary: shared opApply does not compile
Status: NEW
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P4 enhancement
Assignee: No Owner
URL:
Keywords: pull
Depends on:
Blocks:
 
Reported: 2021-03-20 00:10 UTC by Nicholas Wilson
Modified: 2022-12-17 10:31 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 Nicholas Wilson 2021-03-20 00:10:47 UTC
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
Comment 1 Dlang Bot 2021-03-20 00:18:06 UTC
@thewilsonator created dlang/dmd pull request #12290 "Fix issue 21737: shared opApply does not compile" fixing this issue:

- Fix issue 21737: shared opApply does not compile

https://github.com/dlang/dmd/pull/12290