1
0
Fork 0
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:
Brian Fiete 2020-05-13 07:43:59 -07:00
parent d2edcd2ae9
commit d5a2db5a06
3 changed files with 67 additions and 20 deletions

View file

@ -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);
}
}
}