https://bugzilla.novell.com/show_bug.cgi?id=671488
https://bugzilla.novell.com/show_bug.cgi?id=671488#c0 Summary: incorrect CS0159 errors being reported Classification: Mono Product: Mono: Compilers Version: 2.10.x Platform: x86 OS/Version: Windows 7 Status: NEW Severity: Normal Priority: P5 - None Component: C# AssignedTo: [email protected] ReportedBy: [email protected] QAContact: [email protected] Found By: --- Blocker: --- User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13 It seems the combination of goto and switch might be triggering incorrect instances of error CS0159. Here is a simplified example: // Program.cs using System; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { int foo; Console.Write("please enter a number (0, 1, or 2): "); string line = Console.ReadLine(); if (int.TryParse(line, out foo)) { switch (foo) { case 1: gotoTarget: { Console.WriteLine("case 1 done"); break; } default: { Console.WriteLine("default case"); if (foo != 0) { Console.WriteLine("going to goto target"); goto gotoTarget; } Console.WriteLine("default done"); break; } } } } } } Reproducible: Always Steps to Reproduce: 1. Save the above sample code as "Program.cs" 2. Attempt to compile the sample code using gmcs. Actual Results: Program.cs(31,34): error CS0159: The label `gotoTarget:' could not be found within the scope of the goto statement Compilation failed: 1 error(s), 0 warnings Expected Results: An executable assembly file should be produced. No errors or warnings should be generated. This same code compiles perfectly using Mono 2.8 and Visual Studio 2008. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA contact for the bug. _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
