[corlib] Fix a few NSLogWriter issues. (#13799)
[mono-project.git] / mcs / tests / test-786.cs
blob47dab4de2ed0c10d613559339c139aa05725291f
1 using System;
3 public class A
5 public static int Counter;
6 public static implicit operator string (A c)
8 ++Counter;
9 return "A-class";
12 public static implicit operator Delegate (A c)
14 return null;
18 public struct B
20 public static int Counter;
21 public static implicit operator string (B c)
23 ++Counter;
24 return "B-struct";
28 public struct D
30 public static int Counter;
31 public static implicit operator Delegate (D d)
33 ++Counter;
34 return null;
38 public struct E
40 public static int Counter;
41 public static implicit operator bool (E d)
43 ++Counter;
44 return true;
48 public class F
50 public static implicit operator bool (F f)
52 throw new ApplicationException ();
56 class Program
58 public static int Main ()
60 if (new B () != new B () || B.Counter != 2)
61 return 1;
63 if (new B () != "B-struct" || B.Counter != 3)
64 return 2;
66 if (new B () == null || B.Counter != 4) {
67 // FIXME: Incorrect null lifting
68 //return 3;
71 if (new D () != new D () || D.Counter != 2)
72 return 10;
74 if (new D () != null || D.Counter != 3) {
75 // FIXME: Incorrect null lifting
76 //return 11;
79 if (new A () != "A-class" || A.Counter != 1)
80 return 20;
82 if (new A () == null || A.Counter != 1)
83 return 21;
85 if (new E () != new E () || E.Counter != 2)
86 return 31;
88 if (new F () == new F ())
89 return 40;
91 Console.WriteLine ("ok");
92 return 0;