[Mono-bugs] [Bug 62275][Nor] Changed - delegate dispatch to a base class inconsistent with ms.net

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Mon, 2 Aug 2004 17:17:02 -0400 (EDT)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by bmaurer@users.sf.net.

http://bugzilla.ximian.com/show_bug.cgi?id=62275

--- shadow/62275	2004-08-02 08:19:52.000000000 -0400
+++ shadow/62275.tmp.30633	2004-08-02 17:17:02.000000000 -0400
@@ -2,13 +2,13 @@
 Product: Mono: Compilers
 Version: unspecified
 OS: All
 OS Details: 
 Status: NEW   
 Resolution: 
-Severity: 
+Severity: Unknown
 Priority: Normal
 Component: C#
 AssignedTo: mono-bugs@ximian.com                            
 ReportedBy: ianm@activestate.com               
 QAContact: mono-bugs@ximian.com
 TargetMilestone: ---
@@ -94,6 +94,52 @@
 consistently
 
 Additional Information:
 note that compiling the same code with csc gives correct results on both
 mono and .net runtimes. Compiling with mcs gives incorrect on both -
 leading me to belive that its a code generation issue with mcs.
+
+------- Additional Comments From bmaurer@users.sf.net  2004-08-02 17:17 -------
+Simpler:
+class X {
+	public virtual int Foo () {            
+		return 1;
+	}
+}
+
+class Y : X {
+
+	delegate int D();
+	
+	
+	D GetIt () {
+		return new D (base.Foo);
+	}
+	
+	public override int Foo () {
+		return 0;
+	}
+	
+	static void Main ()
+	{
+		System.Console.WriteLine (new Y ().GetIt () ());
+	}
+}
+
+Should print 1.
+
+The problem is we generate this code:
+    .method private hidebysig
+           instance default class 'Y/D' GetIt ()  cil managed
+    {
+        // Method begins at RVA 0x20ff
+        // Code size 14 (0xe)
+        .maxstack 8
+        IL_0000:  ldarg.0
+        IL_0001:  dup
+        IL_0002:  ldvirtftn instance int32 class X::Foo()
+        IL_0008:  newobj instance void class 'Y/D'::.ctor(object,
+native int)
+        IL_000d:  ret
+
+
+ldvirtftn is wrong.