diff options
author | Martin Baulig <martin@novell.com> | 2004-04-02 00:16:57 +0400 |
---|---|---|
committer | Martin Baulig <martin@novell.com> | 2004-04-02 00:16:57 +0400 |
commit | a0ec91a4f21c4e6020054119462481c4ffcfde0a (patch) | |
tree | 6c50e257176585a5317fd001cf000355c7ea5aa5 /mcs/errors/gcs0309-3.cs | |
parent | 773ada8ef77ce31b70eb9ede697c4e11afbfa5ba (diff) |
New test, formerly known as gen-51.cs.
svn path=/trunk/mcs/; revision=24922
Diffstat (limited to 'mcs/errors/gcs0309-3.cs')
-rw-r--r-- | mcs/errors/gcs0309-3.cs | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/mcs/errors/gcs0309-3.cs b/mcs/errors/gcs0309-3.cs new file mode 100644 index 00000000000..2a5bc1223cc --- /dev/null +++ b/mcs/errors/gcs0309-3.cs @@ -0,0 +1,40 @@ +// CS0309: The type 'B' must be convertible to 'A' in order to use it +// as parameter 'T' in the generic type or method 'Foo<T>' +// Line: 35 +using System; + +public class Foo<T> + where T : A +{ + public void Test (T t) + { + Console.WriteLine (t); + Console.WriteLine (t.GetType ()); + t.Hello (); + } +} + +public class A +{ + public void Hello () + { + Console.WriteLine ("Hello World"); + } +} + +public class B +{ + public static implicit operator A (B b) + { + return new A (); + } +} + +class X +{ + Foo<B> b; + + static void Main () + { + } +} |