mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 12:32:20 +02:00
Fixed StructRet issues with delegates and lambdas
This commit is contained in:
parent
d2edcd2ae9
commit
d5a2db5a06
3 changed files with 67 additions and 20 deletions
|
@ -73,5 +73,25 @@ namespace Tests
|
|||
delete dlg;
|
||||
Test.Assert(b == 221);
|
||||
}
|
||||
|
||||
struct StructA
|
||||
{
|
||||
public int mA0;
|
||||
public this(int v) { mA0 = v; }
|
||||
}
|
||||
|
||||
[Test]
|
||||
public static void TestStructRetCapture()
|
||||
{
|
||||
StructA sa = .(5);
|
||||
StructA saGetter() { return sa; }
|
||||
delegate StructA() myTest = scope => saGetter;
|
||||
var ret = myTest();
|
||||
Test.Assert(ret.mA0 == 5);
|
||||
|
||||
delegate StructA() myTest2 = scope [&] () => { return saGetter(); };
|
||||
var ret2 = myTest2();
|
||||
Test.Assert(ret2.mA0 == 5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue