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 [EMAIL PROTECTED]

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

--- shadow/76948        2005-12-08 15:39:29.000000000 -0500
+++ shadow/76948.tmp.16204      2005-12-08 15:39:29.000000000 -0500
@@ -0,0 +1,39 @@
+Bug#: 76948
+Product: Mono: Compilers
+Version: 1.1
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: C#
+AssignedTo: [EMAIL PROTECTED]                            
+ReportedBy: [EMAIL PROTECTED]               
+QAContact: [EMAIL PROTECTED]
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: closures don't capture local vars correctly
+
+using System;
+
+delegate void Do ();
+
+class T {
+        static void doit (int v) {
+                Console.WriteLine (v);
+        }
+        static void Main () {
+                Do[] arr = new Do [5];
+                for (int i = 0; i < 5; ++i) {
+                        arr [i] = delegate {doit (i);};
+                }
+                for (int i = 0; i < 5; ++i) {
+                        arr [i] ();
+                }
+        }
+
+}
+
+The program should print 0, 1, 2, .., but it always prints 5.
_______________________________________________
mono-bugs maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-bugs

Reply via email to