[Mono-bugs] [Bug 77099][Wis] New - Foreach variable lost from
environment in Console.WriteLine
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Tue Dec 27 09:00:42 EST 2005
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 sestoft at dina.kvl.dk.
http://bugzilla.ximian.com/show_bug.cgi?id=77099
--- shadow/77099 2005-12-27 09:00:42.000000000 -0500
+++ shadow/77099.tmp.7323 2005-12-27 09:00:42.000000000 -0500
@@ -0,0 +1,57 @@
+Bug#: 77099
+Product: Mono: Compilers
+Version: 1.1
+OS:
+OS Details: debian linux
+Status: NEW
+Resolution:
+Severity:
+Priority: Wishlist
+Component: C#
+AssignedTo: rharinath at novell.com
+ReportedBy: sestoft at dina.kvl.dk
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Foreach variable lost from environment in Console.WriteLine
+
+Description of Problem:
+
+The sample program below does not compile with gmcs 1.1.12.1 for Linux. It
+should.
+
+Steps to reproduce the problem:
+1. Compile with gmcs
+2. Observe compiler error message.
+
+Actual Results:
+
+Bug18.cs(13,43): error CS0103: The name `x`2' does not exist in the context
+of `MyTest'
+Compilation failed: 1 error(s), 0 warnings
+
+
+Expected Results:
+
+Compiles OK.
+
+Additional Information:
+
+It does compile OK with mcs and csc, and compiles OK with gmcs if fewer
+arguments are given to Console.WriteLine.
+
+Here's the program:
+
+
+using System;
+
+class MyTest {
+ public static void Main(String[] args) {
+ int[] ivals = { 2, 5 };
+ foreach (int x in ivals)
+ foreach (int y in ivals)
+ Console.WriteLine("{0} {1} {2} {3} {4} {5}",
+ x, y, x+y, x-y, x<y, x>=y);
+ }
+}
More information about the mono-bugs
mailing list