[Mono-bugs] [Bug 24511] New - mcs error in switch statement
bugzilla-daemon@rocky.ximian.com
bugzilla-daemon@rocky.ximian.com
10 May 2002 13:29:17 -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 detlev@die-offenbachs.de.
http://bugzilla.ximian.com/show_bug.cgi?id=24511
--- shadow/24511 Fri May 10 09:29:17 2002
+++ shadow/24511.tmp.17804 Fri May 10 09:29:17 2002
@@ -0,0 +1,64 @@
+Bug#: 24511
+Product: Mono/MCS
+Version: unspecified
+OS: other
+OS Details: SuSE 8.0
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: Misc
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: detlev@die-offenbachs.de
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: mcs error in switch statement
+
+he attached example taken from
+"Programming C#" should produce a compiler error according to the book
+and several tutorials. However, mcs v0.11 doesn't produce such an error
+for the case "LiberalRepublican".
+
+The code is as follows.
+
+using System;
+
+class Values {
+ static void Main() {
+ const int Democrat = 0;
+ const int LiberalRepublican = 1;
+ const int Republican = 2;
+ const int Libertarian = 3;
+ const int NewLeft = 4;
+ const int Progressive = 5;
+
+ int myChoice = LiberalRepublican;
+
+ switch (myChoice) {
+ case Democrat:
+ Console.WriteLine("You voted Democratic.\n");
+ break;
+ case LiberalRepublican: // fall through
+ Console.WriteLine(
+ "Liberal Republicans vote Republican.");
+ case Republican:
+ Console.WriteLine("You voted Republican.\n");
+ break;
+ case NewLeft:
+ Console.WriteLine("NewLeft is now Progressive");
+ goto case Progressive;
+ case Progressive:
+ Console.WriteLine("You voted Progressive.\n");
+ break;
+ case Libertarian:
+ Console.WriteLine("Libertarians are voting Republican");
+ goto case Republican;
+ default:
+ Console.WriteLine("You did not pick a valid choices.\n");
+ break;
+ }
+ Console.WriteLine("Thank you for voting.");
+ }
+}