-//
-// This is a test for as expression
-// in custom attribute constructors
-//
-
using System;
-class MyAttribute : Attribute {
+enum E : byte
+{
+ V
+}
- public MyAttribute (string s)
+class A
+{
+ int value;
+
+ private A (int value)
{
+ this.value = value;
+ }
+
+ public static implicit operator byte (A a)
+ {
+ return 6;
}
-}
-
-[My (null as string)]
-class X {
- static void Main ()
+ public static implicit operator A (int a)
{
+ return new A (a);
}
-}
+
+ public static int Main ()
+ {
+ var a = new A (0);
+ a++;
+ if (a.value != 7)
+ return 1;
+
+ var e = E.V;
+ e++;
+
+ if ((int) e != 1)
+ return 2;
+
+ return 0;
+ }
+}
\ No newline at end of file