1 // Compiler options: -unsafe
4 using System
.Linq
.Expressions
;
6 delegate void EmptyDelegate ();
7 unsafe delegate int* UnsafeDelegate ();
18 static unsafe int* Foo ()
23 public static int Main ()
25 Expression
<Func
<EmptyDelegate
>> e
= () => new EmptyDelegate (Test
);
27 if (e
.Body
.ToString () != "Convert(CreateDelegate(EmptyDelegate, null, Void Test()))")
36 Expression
<Func
<EmptyDelegate
>> e2
= () => Test
;
37 if (e2
.Body
.ToString () != "Convert(CreateDelegate(EmptyDelegate, null, Void Test()))")
40 var v2
= e2
.Compile ();
47 Expression
<Func
<UnsafeDelegate
>> e3
= () => new UnsafeDelegate (Foo
);
48 if (e3
.Body
.ToString () != "Convert(CreateDelegate(UnsafeDelegate, null, Int32* Foo()))")
51 var v3
= e3
.Compile ();
52 if (v3
.Invoke ()() != (int*)1)
56 Console
.WriteLine ("OK");