File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
src/tests/JIT/interpreter Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -65,6 +65,17 @@ public MyStruct2(int val)
65
65
}
66
66
}
67
67
68
+ public struct StructWithRefs
69
+ {
70
+ public MyObj o1 , o2 ;
71
+
72
+ public StructWithRefs ( int val1 , int val2 )
73
+ {
74
+ o1 = new MyObj ( val1 ) ;
75
+ o2 = new MyObj ( val2 ) ;
76
+ }
77
+ }
78
+
68
79
public class InterpreterTest
69
80
{
70
81
static int Main ( string [ ] args )
@@ -93,6 +104,8 @@ public static void RunInterpreterTests()
93
104
Environment . FailFast ( null ) ;
94
105
if ( ! TestFields ( ) )
95
106
Environment . FailFast ( null ) ;
107
+ if ( ! TestStructRefFields ( ) )
108
+ Environment . FailFast ( null ) ;
96
109
// FIXME: Calling TestSpecialFields causes the following System.GC.Collect to fail.
97
110
/*
98
111
if (!TestSpecialFields())
@@ -214,6 +227,24 @@ public static bool TestFields()
214
227
return true ;
215
228
}
216
229
230
+ public static bool TestStructRefFields ( )
231
+ {
232
+ StructWithRefs s = new StructWithRefs ( 3 , 42 ) ;
233
+ if ( s . o1 . str . a != 3 )
234
+ return false ;
235
+ if ( s . o2 . str . a != 42 )
236
+ return false ;
237
+
238
+ System . GC . Collect ( ) ;
239
+
240
+ if ( s . o1 . str . a != 3 )
241
+ return false ;
242
+ if ( s . o2 . str . a != 42 )
243
+ return false ;
244
+
245
+ return true ;
246
+ }
247
+
217
248
[ ThreadStatic ]
218
249
public static MyObj threadStaticObj ;
219
250
[ ThreadStatic ]
You can’t perform that action at this time.
0 commit comments