[Mono-bugs] [Bug 39828][Nor] New - Individual switch-sections treated as blocks by mcs
bugzilla-daemon@rocky.ximian.com
bugzilla-daemon@rocky.ximian.com
Mon, 17 Mar 2003 06:17:34 -0500 (EST)
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 kokholm@it-c.dk.
http://bugzilla.ximian.com/show_bug.cgi?id=39828
--- shadow/39828 Mon Mar 17 06:17:34 2003
+++ shadow/39828.tmp.19546 Mon Mar 17 06:17:34 2003
@@ -0,0 +1,51 @@
+Bug#: 39828
+Product: Mono/MCS
+Version: unspecified
+OS: All
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: Misc
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: kokholm@it-c.dk
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Individual switch-sections treated as blocks by mcs
+
+mcs version 0.23 does not allow goto from one switch-section
+to a label in another switch-section in the same switch-block.
+It seems that the parser treats each switch-section as an
+individual block.
+
+The program below compiles correctly under the MS .NET Framework
+SDK csc and produces the expected output
+1
+4
+
+Under mcs 0.23 the compiler complains that
+Error.cs(8) error CS0159: No such label `LBL4' in this scope
+Compilation failed: 1 error(s), 0 warnings
+
+-------------------------snip----------------------------------
+class Error {
+ public static void Main() {
+ int i = 1;
+ switch (i) {
+ case 1:
+ System.Console.WriteLine("1");
+ if (i>0)
+ goto LBL4;
+ System.Console.WriteLine("2");
+ break;
+ case 3:
+ System.Console.WriteLine("3");
+ LBL4:
+ System.Console.WriteLine("4");
+ break;
+ }
+ }
+}