[Mono-bugs] [Bug 78502][Nor] New - CS0309 error when including an IEnumerable with a yield command

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Wed May 24 15:16:23 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 scottell.lists at gmail.com.

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

--- shadow/78502	2006-05-24 15:16:23.000000000 -0400
+++ shadow/78502.tmp.25807	2006-05-24 15:16:23.000000000 -0400
@@ -0,0 +1,52 @@
+Bug#: 78502
+Product: Mono: Compilers
+Version: 1.1
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: C#
+AssignedTo: rharinath at novell.com                            
+ReportedBy: scottell.lists at gmail.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: CS0309 error when including an IEnumerable with a yield command
+
+The below code compiles fine on MS.NET 2.0.  However, it fails on Mono (
+1.1.13.6 ) with the following error:
+
+icomp.cs(9,24): error CS0309: The type `T' must be convertible to
+`System.IComparable<T>' in order to use it as parameter `T' in the generic
+type or method `Node<T,U>'
+icomp.cs(5,14):: `Node<T,U>', name of symbol related to previous error
+icomp.cs(7,14):: `', name of symbol related to previous error
+Compilation failed: 1 error(s), 0 warnings
+
+Strangely, if I removed the "yield" call, it compiles.
+
+==begin sample code==
+
+using System;
+using System.Collections.Generic;
+using System.Collections;
+
+public class Node<T,U> where T : IComparable<T> { }
+
+public class BinaryTree<T, U> where T : IComparable<T>
+{
+	Node<T, U> root = new Node<T, U>();
+
+	IEnumerable Test ()
+	{
+		yield return 0;
+	}
+}
+
+public class M
+{
+	public static void Main () {}
+}


More information about the mono-bugs mailing list