[Mono-bugs] [Bug 75085][Nor] New - gmcs does not like generic method pointers from external libraries

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Sun May 29 03:49:24 EDT 2005


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 dsilva at ccs.neu.edu.

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

--- shadow/75085	2005-05-29 03:49:24.000000000 -0400
+++ shadow/75085.tmp.12647	2005-05-29 03:49:24.000000000 -0400
@@ -0,0 +1,68 @@
+Bug#: 75085
+Product: Mono: Compilers
+Version: 1.1
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: C#
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: dsilva at ccs.neu.edu               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: gmcs does not like generic method pointers from external libraries
+
+Description of Problem:
+
+gmcs does not compile code that points to an instantiated generic method
+from a referenced dll.
+
+
+Steps to reproduce the problem:
+
+dsilva at ds:/tmp$ cat define-delegate.cs
+
+public class FP {
+ public delegate U Mapping<T, U>(T obj);
+
+ public static T identity<T>(T obj) { return obj; }
+}
+
+dsilva at ds:/tmp$ cat use-delegate.cs
+
+public class App {
+  public static void Main() {
+    string s = apply<int, string>(3,
+                                  delegate (int x) {
+                                    return x.ToString(); });
+    int y = apply<int, int>(3, FP.identity<int>);
+  }
+
+  static U apply<T, U>(T obj, FP.Mapping<T, U> f) {
+    return f(obj);
+  }
+}
+
+
+Actual Results:
+
+dsilva at ds:/tmp$ gmcs -target:library define-delegate.cs
+dsilva at ds:/tmp$ gmcs -r:define-delegate.dll use-delegate.cs
+use-delegate.cs(7) error CS0123: Method 'int FP.identity (int)' does not
+match delegate 'int FP+Mapping`2<System.Int32,System.Int32> (int)'
+use-delegate.cs(7) error CS1502: The best overloaded match for method
+'App.apply(in int, FP.Mapping`2)' has some invalid arguments
+use-delegate.cs(7) error CS1503: Argument 2: Cannot convert from 'object'
+to 'FP.Mapping`2'
+use-delegate.cs(7) error CS1501: No overload for method `apply' takes `2'
+arguments
+Compilation failed: 4 error(s), 0 warnings
+
+
+Expected Results:
+
+No errors.


More information about the mono-bugs mailing list