[Mono-bugs] [Bug 78435][Wis] New - gmcs and IComparable<T> silliness

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Thu May 18 04:31:51 EDT 2006


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 adrinael at adrinael.net.

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

--- shadow/78435	2006-05-18 04:31:51.000000000 -0400
+++ shadow/78435.tmp.15673	2006-05-18 04:31:51.000000000 -0400
@@ -0,0 +1,83 @@
+Bug#: 78435
+Product: Mono: Compilers
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: C#
+AssignedTo: rharinath at novell.com                            
+ReportedBy: adrinael at adrinael.net               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: gmcs and IComparable<T> silliness
+
+Here's my testcase
+
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+
+internal struct bar<V>
+{
+	public V get()
+	{
+		return default(V);
+	}
+}
+
+public class foo<
+#if BREAK_IT
+K,
+#endif
+ V>
+#if BREAK_IT
+ : IEnumerable<V>
+#endif
+	where V : IComparable<V>
+{
+#if BREAK_IT
+	public IEnumerator<V> GetEnumerator()
+	{
+		yield break;
+	}
+
+        IEnumerator IEnumerable.GetEnumerator()
+        {
+        	yield break;
+        }
+#endif
+
+	private bar<V> m;
+
+	public int func()
+	{
+		return m.get().CompareTo(m.get());
+	}
+}
+
+
+
+The CompareTo call is failing to compile when BREAK_IT is defined, saying
+
+compare.cs(39,10): error CS1502: The best overloaded method match for
+`System.IComparable<K>.CompareTo(K)' has some invalid arguments
+compare.cs(39,10): error CS1503: Argument 1: Cannot convert from `V' to `K'
+
+I need to inherit from IEnumerable<> _and_ have another generics parameter
+in the class to make it break. Oh, what fun.
+
+And an additional data point: That error was with 1.1.13. Here's what svn's
+ gmcs says instead:
+compare.cs(39,10): error CS1502: The best overloaded method match for
+`System.IComparable<K,V>.CompareTo(K)' has some invalid arguments
+compare.cs(39,10): error CS1503: Argument 1: Cannot convert from `V' to `K'
+
+(Difference: IComparable<K,V>)
+
+o_O


More information about the mono-bugs mailing list