February 20, 2022 [Issue 22799] New: opApply() delegates not required to be scope | ||||
|---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=22799 Issue ID: 22799 Summary: opApply() delegates not required to be scope Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nobody@puremagic.com Reporter: bugzilla@digitalmars.com The spec https://dlang.org/spec/statement.html#foreach_over_struct_and_classes shows the delegate to be declared as `scope`. But the compiler does not enforce it: struct S { int opApply (/*scope*/ int delegate (int* ptr) @safe dg) @safe { return 0; } } void test(S s) @safe { foreach (int* x; s) { } } compiles without error. -- | ||||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply