mirror of
https://github.com/dlang/dmd.git
synced 2025-04-26 05:00:16 +03:00

* Fix 23722 - Lambdas are mangled incorrectly when using multiple compilation units, resulting in incorrect code * Update test cases
26 lines
679 B
D
26 lines
679 B
D
/* TEST_OUTPUT:
|
|
---
|
|
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)`
|
|
fail_compilation/opapplyscope.d(113): cannot pass argument `__foreachbody_L113_C5` of type `int delegate(int* x) nothrow @nogc @safe` to parameter `scope int delegate(scope int* ptr) @safe dg`
|
|
---
|
|
*/
|
|
|
|
#line 100
|
|
|
|
struct S
|
|
{
|
|
int opApply(scope int delegate (scope int* ptr) @safe dg) @safe
|
|
{
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
void test() @safe
|
|
{
|
|
static int* global;
|
|
S s;
|
|
foreach (/*scope*/ int* x; s)
|
|
{
|
|
global = x;
|
|
}
|
|
}
|