www.emsdn.com
Class Profile: Home »» Development [Development] under "Development" »»» Is this a new bug?

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;
}
}
}
}
[nikki@router Test]$ mcs Test.cs
[nikki@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@router Test]$ mcs Test.cs
[nikki@router Test]$ mono Test.exe
switch on 'TSP100'
case TSP100
Using mono 1.1.15 on CS 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.


No. 1# | By Developer Tags User at [2008-5-5] | size: 431 bytes

K P wrote:
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/

I already reported it (see original message)

Message
From: "Nikki Locke" <nikki (AT) trumphurst (DOT) com

Posted as bug 78860, as I couldn't find anything similar.

No. 1# | By Developer Tags User at [2008-5-5] | size: 968 bytes

K P wrote:
Right.:) I didn't expect anything after the code.

That's probably because you're a top poster, who is used to seeing the most
recent information first. Us traditional bottom posters expect information in
chronological order, top to bottom. :-) :-) :-)

Note that if you report a bug using bugzilla you don't have to post it to
the list as well. I just tried to answer your question in subject: "Is this
a new bug?"

I thought the information would be useful to other list users, as it is a nasty
bug which could catch anyone out, and which is only revealed by careful
testing. I would certainly like to have known about it in advance, and I
haven't found anywhere in bugzilla where you can get a programmer-friendly list
of bugs which might bite you.

However, if the list isn't the right place to post this kind of heads up
warning, please let me know, and I will desist.



Development Hot!

Development New!


Copyright © 2008 www.emsdn.com • All rights reserved • CMS Theme by www.emsdn.com - 0.172