[Mono-bugs] [Bug 78860][Wis] New - case null immediately following another case is always matched
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Fri Jul 14 13:32:13 EDT 2006
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 nikki at trumphurst.com.
http://bugzilla.ximian.com/show_bug.cgi?id=78860
--- shadow/78860 2006-07-14 13:32:13.000000000 -0400
+++ shadow/78860.tmp.5266 2006-07-14 13:32:13.000000000 -0400
@@ -0,0 +1,85 @@
+Bug#: 78860
+Product: Mono: Compilers
+Version: 1.0
+OS: other
+OS Details: CentOS 4
+Status: NEW
+Resolution:
+Severity:
+Priority: Wishlist
+Component: C#
+AssignedTo: rharinath at novell.com
+ReportedBy: nikki at trumphurst.com
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: case null immediately following another case is always matched
+
+using System;
+
+namespace SpecSoft.Lib {
+
+ public class Test {
+
+ public static void Main() {
+ string model = "TSP100";
+
+ System.Console.WriteLine("switch on '{0}'", model);
+
+ switch(model) {
+ case "wibble":
+ case null:
+ System.Console.WriteLine("case null !!!!");
+ break;
+ case "TSP100":
+ System.Console.WriteLine("case TSP100");
+ break;
+ }
+ }
+
+ }
+}
+
+[nikki at router Test]$ mcs Test.cs
+[nikki at router Test]$ mono Test.exe
+switch on 'TSP100'
+case null !!!!
+
+Reordering the first two cases to
+
+using System;
+
+namespace SpecSoft.Lib {
+
+ public class Test {
+
+ public static void Main() {
+ string model = "TSP100";
+
+ System.Console.WriteLine("switch on '{0}'", model);
+
+ switch(model) {
+ case null:
+ case "wibble":
+ System.Console.WriteLine("case null !!!!");
+ break;
+ case "TSP100":
+ System.Console.WriteLine("case TSP100");
+ break;
+ }
+ }
+
+ }
+}
+
+Gives the correct output:
+
+[nikki at router Test]$ mcs Test.cs
+[nikki at router Test]$ mono Test.exe
+switch on 'TSP100'
+case TSP100
+
+Using mono 1.1.15 on CentOS 4 Linux.
+The smae program, compiled using MS C#, but run under Mono, gives the
+correct behaviour.
More information about the mono-bugs
mailing list