https://bugzilla.novell.com/show_bug.cgi?id=342584#c2





--- Comment #2 from Marek Safar <[EMAIL PROTECTED]>  2007-11-19 06:05:45 MST ---
csc produces this

  IL_0001:  ldloca.s   V_0
  IL_0003:  ldc.i4.1
  IL_0004:  call       instance void [mscorlib]System.IntPtr::.ctor(int32)
  IL_0009:  nop
  IL_000a:  ldloc.0
  IL_000b:  call       int32 [mscorlib]System.IntPtr::op_Explicit(native int)
  IL_0010:  stloc.1
  IL_0011:  ret

so there is an explicit operator call. However following code is exactly same
except it uses custom type instead of IntPtr and it gets rejected by csc.
This looks like another csc weirdness.

Secondly changing enum base type to ulong has no effect and csc still uses
explicit int32 (IntPtr) conversion and then conv.i8


enum Key
{
        V
}

struct S
{
        public static explicit operator int (S val)
        {
                return 1;
        }
}

class C
{
        E Foo ()
        {
                S s = new S ();
                return (Key) s;
        }
}


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
_______________________________________________
mono-bugs maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-bugs

Reply via email to