2009-01-24 Zoltan Varga <vargaz@gmail.com>
[mcs.git] / tests / test-119.cs
blobbe7d7695a226769d66e653e436fe9df06406ad3a
1 class Value {
2 public static explicit operator int (Value val)
4 return 1;
7 public static explicit operator MyObject (Value val)
9 return new MyObject (1);
12 public static explicit operator uint (Value val)
14 return 1;
18 class MyObject {
19 public MyObject (int i) {}
22 class Derived : MyObject {
23 public Derived (int i) : base (i) { }
25 Derived Blah ()
27 Value val = new Value ();
29 return (Derived) val;
33 class Test {
34 static int Main ()
36 Value v = new Value ();
38 v = null;
40 try {
41 // This will throw an exception.
42 // This test is more of a compile test, we need a real
43 // good test that does not require this lame catch.
44 Derived d = (Derived) v;
45 } catch {
48 return 0;