Flush (work in progress)
[mono.git] / mcs / errors / gcs0311-3.cs
1 // CS0311: The type `B' cannot be used as type parameter `T' in the generic type or method `Foo<T>'. There is no implicit reference conversion from `B' to `A'
2 // Line: 35
3 using System;
4
5 public class Foo<T>
6         where T : A
7 {
8         public void Test (T t)
9         {
10                 Console.WriteLine (t);
11                 Console.WriteLine (t.GetType ());
12                 t.Hello ();
13         }
14 }
15
16 public class A
17 {
18         public void Hello ()
19         {
20                 Console.WriteLine ("Hello World");
21         }
22 }
23
24 public class B
25 {
26         public static implicit operator A (B b)
27         {
28                 return new A ();
29         }
30 }
31
32 class X
33 {
34         Foo<B> b;
35
36         static void Main ()
37         {
38         }
39 }