New test.
authorMartin Baulig <martin@novell.com>
Sun, 28 Nov 2004 14:39:14 +0000 (14:39 -0000)
committerMartin Baulig <martin@novell.com>
Sun, 28 Nov 2004 14:39:14 +0000 (14:39 -0000)
svn path=/trunk/mcs/; revision=36714

mcs/tests/Makefile
mcs/tests/gen-112.cs [new file with mode: 0644]

index c31acfdb747c10e44fba8cb7b56415f52bbecff5..08ed8e3aa5c44b61cb03a7144687e17ec5dd941c 100644 (file)
@@ -103,7 +103,7 @@ TEST_SOURCES_net_2_0 = \
        gen-81  gen-82  gen-83  gen-84  gen-85  gen-86  gen-87  gen-88  gen-89  gen-90  \
        gen-91  gen-92  gen-93  gen-94  gen-95  gen-96  gen-97                  gen-100 \
        gen-101 gen-102 gen-103 gen-104 gen-105 gen-106 gen-107 gen-108 gen-109         \
-       gen-111
+       gen-111 gen-112
 
 TEST_EXCLUDES_net_2_0 =
 
diff --git a/mcs/tests/gen-112.cs b/mcs/tests/gen-112.cs
new file mode 100644 (file)
index 0000000..47ebf9e
--- /dev/null
@@ -0,0 +1,66 @@
+using System;
+
+public interface IComparer<T>
+{
+       void Compare (T a);
+}
+
+class IC : IComparer<Foo<int>>
+{
+       public void Compare (Foo<int> a)
+       { }
+}
+
+public struct Foo<K>
+{
+       public K Value;
+
+       public Foo (K value)
+       {
+               Value = value;
+       }
+}
+
+public class List<T>
+{
+       public virtual void Sort (IComparer<T> c, T t)
+       {
+               Sorting.IntroSort<T> (c, t);
+       }
+}
+
+public class Sorting
+{
+       public static void IntroSort<T> (IComparer<T> c, T t)
+       {
+               new Sorter<T> (c, 4, t).InsertionSort (0);
+       }
+
+       class Sorter<T>
+       {
+               IComparer<T> c;
+               T[] a;
+
+               public Sorter (IComparer<T> c, int size, T item)
+               {
+                       this.c = c;
+                       a = new T [size];
+               }
+
+               internal void InsertionSort (int i)
+               {
+                       T other;
+                       c.Compare (other = a[i]);
+               }
+       }
+}
+
+class X
+{
+       static void Main ()
+       {
+               List<Foo<int>> list = new List<Foo<int>> ();
+               Foo<int> foo = new Foo<int> (3);
+               list.Sort (new IC (), foo);
+       }
+}