[Mono-bugs] [Bug 23699] New - foreach does not check type for the 'in' parameter

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
20 Apr 2002 17:03:34 -0000


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 pt99par@student.bth.se.

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

--- shadow/23699	Sat Apr 20 13:03:34 2002
+++ shadow/23699.tmp.16401	Sat Apr 20 13:03:34 2002
@@ -0,0 +1,34 @@
+Bug#: 23699
+Product: Mono/MCS
+Version: unspecified
+OS: 
+OS Details: Mandrake 8.2
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: Misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: pt99par@student.bth.se               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: foreach does not check type for the 'in' parameter
+
+Please fill in this template when reporting a bug, unless you know what you are 
+doing. 
+Description of Problem: 
+It is possible to have any type for the in part in 'foreach' statement. 
+ 
+Test case: 
+public class Test { 
+ 
+    public static void Main(string[] args) { 
+	int a = 0; 
+	foreach( int b in 5 ) { Console.WriteLine( b ); } 
+    } 
+} 
+--------- 
+This code compiles.. it should however complain that the type does 
+not implment IEnumerable and IEnumerator .. check with csc.exe