Hi, This is a bug in mcs (it produces incorrect IL code). I don't know whether it's already reported.
If you don't find any matching bug report, please report the bug at http://bugzilla.ximian.com/ Kornél ----- Original Message ----- From: "Nikki Locke" <[EMAIL PROTECTED]> To: <[email protected]> Sent: Friday, July 14, 2006 7:00 PM Subject: [Mono-list] Is this a new bug? > 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 same code, compiled using MS C#, but run under Mono, gives the correct > output. > > Posted as bug 78860, as I couldn't find anything similar. > > -- > Nikki Locke, Trumphurst Ltd. PC & Unix consultancy & programming > http://www.trumphurst.com/ > > > _______________________________________________ > Mono-list maillist - [email protected] > http://lists.ximian.com/mailman/listinfo/mono-list _______________________________________________ Mono-list maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-list
