Bugzilla – Bug 319849
[GMCS] type parameter constraint on generic iterator method
Last modified: 2007-09-15 21:24:23 UTC
---- Reported by sestoft@dina.kvl.dk 2005-12-20 04:41:48 MST ---- Description of Problem: The constraint on a type parameter T of a generic iterator (yield) method seems to be forgotten, or only partially taken into account, in the class generated by gmcs for the iterator method. Steps to reproduce the problem: 1. Compile the program below Actual Results: sestoft@jones:~/cs$ gmcs https://bugzilla.novell.com/show_bug.cgi?id=MONO17.cs https://bugzilla.novell.com/show_bug.cgi?id=MONO17.cs(14,17): error CS1502: The best overloaded method match for `IComparable<T>.CompareTo<>(T)' has some invalid arguments https://bugzilla.novell.com/show_bug.cgi?id=MONO17.cs(14,17): error CS1503: Argument 1: Cannot convert from `T' to `T' Compilation failed: 2 error(s), 0 warnings Expected Results: Compiles OK. Additional Information: Test case: using System; using System.Collections.Generic; public class H { public static void Main(String[] args) { } public static IEnumerable<T> Merge<T>(IEnumerator<T> xEtor) where T : IComparable<T> { int order = xEtor.Current.CompareTo(xEtor.Current); yield return xEtor.Current; } } ---- Additional Comments From martin@ximian.com 2006-01-09 05:48:08 MST ---- Post-GUAM bug-fixing pass; week #2/2006. ---- Additional Comments From martin@ximian.com 2006-01-10 14:10:19 MST ---- *** https://bugzilla.novell.com/show_bug.cgi?id=MONO77158 has been marked as a duplicate of this bug. *** ---- Additional Comments From martin@ximian.com 2006-01-10 14:12:52 MST ---- Fixed in SVN; r55312. Unknown operating system unknown. Setting to default OS "Other".