Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / mcs / tests / test-535.cs
1 //
2 // Test for conversions that were supposed to be explicit operator
3 // conversions on UIntPtr and IntPtr, but due to historical reasons
4 // ended up in the CSC compiler.
5 //
6 // See bug http://bugzilla.ximian.com/show_bug.cgi?id=59800 for details
7 //
8 // The conversions are:
9 //   UIntPtr->SByte
10 //   UIntPtr->Int16
11 //   UIntPtr->Int32
12 //   IntPtr->UInt64
13 //   UInt64->IntPtr
14 //   SByte->UIntPtr
15 //   Int16->UIntPtr
16 //   Int32->UIntPtr
17         
18 using System;
19 class X {
20         public static void Main ()
21         {
22                 UIntPtr a = (UIntPtr) 1;
23
24                 // from uintptr
25                 sbyte _sbyte = (sbyte) a;
26                 short _short = (short) a;
27                 int   _int   = (int) a;
28
29                 // uint64 to intptr
30                 IntPtr _intptr = (IntPtr) 1;
31                 ulong _ulong = (ulong) _intptr;
32
33                 // to intptr
34                 UIntPtr _uptr = (UIntPtr) _sbyte;
35                 _uptr = (UIntPtr) _short;
36                 _uptr = (UIntPtr) _int;
37         }
38
39         static void Compile ()
40         {
41                 IntPtr a = (IntPtr) 1;
42                 M (a);
43         }
44         
45         static void M (long l){}
46         static void M (UInt64 l){}
47         static void M (object o){}
48         
49 }