File tree 1 file changed +31
-0
lines changed
src/tests/JIT/interpreter
1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,17 @@ public MyStruct2(int val)
38
38
}
39
39
}
40
40
41
+ public struct StructWithRefs
42
+ {
43
+ public MyObj o1 , o2 ;
44
+
45
+ public StructWithRefs ( int val1 , int val2 )
46
+ {
47
+ o1 = new MyObj ( val1 ) ;
48
+ o2 = new MyObj ( val2 ) ;
49
+ }
50
+ }
51
+
41
52
public class InterpreterTest
42
53
{
43
54
static int Main ( string [ ] args )
@@ -66,6 +77,8 @@ public static void RunInterpreterTests()
66
77
Environment . FailFast ( null ) ;
67
78
if ( ! TestFields ( ) )
68
79
Environment . FailFast ( null ) ;
80
+ if ( ! TestStructRefFields ( ) )
81
+ Environment . FailFast ( null ) ;
69
82
// FIXME: Calling TestSpecialFields causes the following System.GC.Collect to fail.
70
83
/*
71
84
if (!TestSpecialFields())
@@ -185,6 +198,24 @@ public static bool TestFields()
185
198
return true ;
186
199
}
187
200
201
+ public static bool TestStructRefFields ( )
202
+ {
203
+ StructWithRefs s = new StructWithRefs ( 3 , 42 ) ;
204
+ if ( s . o1 . str . a != 3 )
205
+ return false ;
206
+ if ( s . o2 . str . a != 42 )
207
+ return false ;
208
+
209
+ System . GC . Collect ( ) ;
210
+
211
+ if ( s . o1 . str . a != 3 )
212
+ return false ;
213
+ if ( s . o2 . str . a != 42 )
214
+ return false ;
215
+
216
+ return true ;
217
+ }
218
+
188
219
[ ThreadStatic ]
189
220
public static MyObj threadStaticObj ;
190
221
[ ThreadStatic ]
You can’t perform that action at this time.
0 commit comments