[Mono-bugs] [Bug 24007] New - Scope of variables declared inside a switch case
bugzilla-daemon@rocky.ximian.com
bugzilla-daemon@rocky.ximian.com
29 Apr 2002 17:41:20 -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 lupus@ximian.com.
http://bugzilla.ximian.com/show_bug.cgi?id=24007
--- shadow/24007 Mon Apr 29 13:41:20 2002
+++ shadow/24007.tmp.29525 Mon Apr 29 13:41:20 2002
@@ -0,0 +1,42 @@
+Bug#: 24007
+Product: Mono/MCS
+Version: unspecified
+OS: other
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Wishlist
+Component: Misc
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: lupus@ximian.com
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Scope of variables declared inside a switch case
+
+The scope of a variable declared inside a switch case propagates also to
+the next cases. The sample program compiles fine with csc, but fails with
+mcs on both the mono and ms runtime.
+
+class T {
+ static int Main() {
+ int v = 10;
+ int a;
+
+ switch (v) {
+ case 0:
+ int i = v + 1;
+ a = i;
+ break;
+ default:
+ i = 5;
+ a = i;
+ break;
+ }
+ if (a != 5)
+ return 1;
+ return 0;
+ }
+}