[Mono-bugs] [Bug 73995][Nor] New - [GMCS] runtime cannot handle either generic "where" or overloaded generic methods

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Wed, 23 Mar 2005 00:11:14 -0500 (EST)


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 atsushi@ximian.com.

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

--- shadow/73995	2005-03-23 00:11:14.000000000 -0500
+++ shadow/73995.tmp.18196	2005-03-23 00:11:14.000000000 -0500
@@ -0,0 +1,59 @@
+Bug#: 73995
+Product: Mono: Runtime
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: atsushi@ximian.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: [GMCS] runtime cannot handle either generic "where" or overloaded generic methods
+
+The example code below cannot run under mono runtime. Note that the code
+won't compile with gmcs because of bug #73992 and bug #73993, so you will
+need MS csc unless those bugs got fixed.
+
+----
+using System;
+static class Test1 {
+  public interface IOp<T> {
+    T Func(uint v);
+  }
+  public struct Op : IOp<ushort>, IOp<uint> {
+    ushort IOp<ushort>.Func(uint v) { return (ushort )(v * 2); }
+    uint IOp<uint>.Func(uint v) { return v * 4; }
+  }
+  static void Foo<T,OP>(uint v) where T:struct where OP : IOp<T> {
+    OP op = default(OP);
+    System.Console.WriteLine( op.Func(v) );
+  }
+  static public void Main() {
+    Foo<ushort, Op>(100);
+    Foo<uint, Op>(100);
+  }
+};
+----
+
+Actual Results:
+** (test1.exe:6362): WARNING **: Missing method Func in assembly
+/xxx/test1.exe token a000004
+
+Unhandled Exception: System.NullReferenceException: Object reference
+not set to an instance of an object
+in (unmanaged) 0x80ccfe2
+in <0x0000a> Test1:Main ()
+
+Expected Results:
+under MS runtime, it outputs
+200
+400
+
+How often does this happen? 
+consistently.