Skip to content

Commit 6695eb3

Browse files
committed
Add return ref test
1 parent cfb934f commit 6695eb3

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

test/testcase/CodeGenTests.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2846,10 +2846,18 @@ private static int ProbeIsStaticAlive()
28462846
return 0;
28472847
}
28482848

2849+
public static ref int ReturnRef()
2850+
{
2851+
var arr = new int[] { 1, 2, 3, 4, 5, 6 };
2852+
return ref arr[2];
2853+
}
2854+
28492855
public static int Entry()
28502856
{
28512857
Node curr = new Node();
28522858

2859+
ref int retRef = ref ReturnRef();
2860+
28532861
for (int i = 0; i < 10000; ++i)
28542862
{
28552863
curr.next = new Node();
@@ -2862,6 +2870,13 @@ public static int Entry()
28622870
return 10 + res;
28632871
}
28642872

2873+
if (retRef != 3)
2874+
return 20;
2875+
2876+
retRef = 4;
2877+
if (retRef != 4)
2878+
return 21;
2879+
28652880
return 0;
28662881
}
28672882
}

0 commit comments

Comments
 (0)