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 [EMAIL PROTECTED] 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: [EMAIL PROTECTED] +ReportedBy: [EMAIL PROTECTED] +QAContact: [EMAIL PROTECTED] +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; + } + } + + } +} + [EMAIL PROTECTED] Test]$ mcs Test.cs [EMAIL PROTECTED] 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: + [EMAIL PROTECTED] Test]$ mcs Test.cs [EMAIL PROTECTED] 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. _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
