New test.
[mono.git] / mcs / tests / gen-51.cs
1 //
2 // Accoring to the spec (26.7.1), this should compile since
3 // there's an implicit reference conversion from B to A.
4 //
5 // However, csc reports a CS0309.
6 //
7
8 using System;
9
10 public class Foo<T>
11         where T : A
12 {
13         public void Test (T t)
14         {
15                 Console.WriteLine (t);
16                 Console.WriteLine (t.GetType ());
17                 t.Hello ();
18         }
19 }
20
21 public class A
22 {
23         public void Hello ()
24         {
25                 Console.WriteLine ("Hello World");
26         }
27 }
28
29 public class B
30 {
31         public static implicit operator A (B b)
32         {
33                 return new A ();
34         }
35 }
36
37 class X
38 {
39         static void Main ()
40         {
41                 Foo<B> foo = new Foo<B> ();
42                 foo.Test (new B ());
43         }
44 }