| 1 |
/* TEST_OUTPUT: |
| 2 |
--- |
| 3 |
fail_compilation/opapplyscope.d(113): Error: function `opapplyscope.S.opApply(scope int delegate(scope int* ptr) @safe dg)` is not callable using argument types `(int delegate(int* x) nothrow @nogc @safe)` |
| 4 |
fail_compilation/opapplyscope.d(113): cannot pass argument `int(int* x) => 0` of type `int delegate(int* x) nothrow @nogc @safe` to parameter `scope int delegate(scope int* ptr) @safe dg` |
| 5 |
--- |
| 6 |
*/ |
| 7 |
|
| 8 |
#line 100 |
| 9 |
|
| 10 |
struct S |
| 11 |
{ |
| 12 |
int opApply(scope int delegate (scope int* ptr) @safe dg) @safe |
| 13 |
{ |
| 14 |
return 0; |
| 15 |
} |
| 16 |
} |
| 17 |
|
| 18 |
void test() @safe |
| 19 |
{ |
| 20 |
static int* global; |
| 21 |
S s; |
| 22 |
foreach (/*scope*/ int* x; s) |
| 23 |
{ |
| 24 |
global = x; |
| 25 |
} |
| 26 |
} |