You've already forked linux-packaging-mono
Imported Upstream version 5.10.0.47
Former-commit-id: d0813289fa2d35e1f8ed77530acb4fb1df441bc0
This commit is contained in:
parent
88ff76fe28
commit
e46a49ecf1
45
mcs/tests/test-ref-04.cs
Normal file
45
mcs/tests/test-ref-04.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
class X
|
||||
{
|
||||
int field;
|
||||
|
||||
public static int Main ()
|
||||
{
|
||||
var x = new X ();
|
||||
|
||||
x.field = 5;
|
||||
if (!x.Test1 ())
|
||||
return 1;
|
||||
|
||||
x.Test2 ();
|
||||
|
||||
if (x.Test3 ()++ != 6)
|
||||
return 2;
|
||||
|
||||
if (x.field != 7)
|
||||
return 3;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool Test1 ()
|
||||
{
|
||||
ref var x = ref field;
|
||||
int v = x;
|
||||
++x;
|
||||
|
||||
return x == 6;
|
||||
}
|
||||
|
||||
void Test2 ()
|
||||
{
|
||||
ref int x = ref field;
|
||||
x.ToString ();
|
||||
}
|
||||
|
||||
ref int Test3 ()
|
||||
{
|
||||
ref int l = ref field;
|
||||
ref int v = ref l;
|
||||
return ref l;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user