summaryrefslogtreecommitdiff
path: root/tests/src/readytorun/tests/genericsload/usegenericfield.cs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/src/readytorun/tests/genericsload/usegenericfield.cs')
-rw-r--r--tests/src/readytorun/tests/genericsload/usegenericfield.cs39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/src/readytorun/tests/genericsload/usegenericfield.cs b/tests/src/readytorun/tests/genericsload/usegenericfield.cs
new file mode 100644
index 0000000000..770334c6cf
--- /dev/null
+++ b/tests/src/readytorun/tests/genericsload/usegenericfield.cs
@@ -0,0 +1,39 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+//
+
+using System;
+using System.Runtime.CompilerServices;
+
+class Foo<T>
+{
+ [MethodImplAttribute(MethodImplOptions.NoInlining)]
+ internal bool M()
+ {
+ return GenClass<T>.StaticField;
+ }
+}
+
+class Program
+{
+ static int Main()
+ {
+ try
+ {
+ if (!new Foo<string>().M())
+ {
+ Console.WriteLine("FAIL - bad result");
+ return 102;
+ }
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("FAIL - exception caught");
+ return 101;
+ }
+
+ Console.WriteLine("PASS");
+ return 100;
+ }
+}