diff options
Diffstat (limited to 'tests/src/JIT/Generics/Instantiation/delegates/Delegate015.cs')
-rw-r--r-- | tests/src/JIT/Generics/Instantiation/delegates/Delegate015.cs | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/src/JIT/Generics/Instantiation/delegates/Delegate015.cs b/tests/src/JIT/Generics/Instantiation/delegates/Delegate015.cs new file mode 100644 index 0000000000..978ecaafb8 --- /dev/null +++ b/tests/src/JIT/Generics/Instantiation/delegates/Delegate015.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; +using System.Threading; + +internal delegate T GenDelegate<T>(T p1, out T p2); + +internal interface IFoo +{ + int Function(int i, out int j); +} + +internal struct Foo : IFoo +{ + public int Function(int i, out int j) + { + j = i; + return i; + } +} + +internal class Test +{ + public static int Main() + { + int i, j; + IFoo inst = new Foo(); + GenDelegate<int> MyDelegate = new GenDelegate<int>(inst.Function); + i = MyDelegate(10, out j); + + if ((i != 10) || (j != 10)) + { + Console.WriteLine("Failed Sync Invokation"); + return 1; + } + + Console.WriteLine("Test Passes"); + return 100; + } +} + |