Bugzilla – Bug 318311
CS0162 (unreachable code) incorrectly reported for code using goto statement
Last modified: 2007-09-15 21:24:23 UTC
---- Reported by gert.driesen@pandora.be 2005-06-19 09:17:13 MST ---- mcs incorrectly reports CS0162 (Unreachable code detected) for the following code snippet: using System; public class FlowControlTest { public static void Main () { DateTime currentDate = DateTime.Now; if (currentDate.Year > 2000) { goto check_year; } return; check_year: Console.WriteLine ("check year"); return; } } Actual result: test.cs(6) warning CS0162: Unreachable code detected Compilation succeeded - 1 warning(s) Expected result: Succesful compilation without warnings This is the result you get when you use csc. ---- Additional Comments From john.luke@gmail.com 2005-08-22 21:42:53 MST ---- I think this is a dupe of https://bugzilla.novell.com/show_bug.cgi?id=MONO75255 ---- Additional Comments From grompf@sublimeintervention.com 2006-01-06 19:09:09 MST ---- *** https://bugzilla.novell.com/show_bug.cgi?id=MONO77161 has been marked as a duplicate of this bug. *** ---- Additional Comments From martin@ximian.com 2006-03-21 18:53:47 MST ---- *** This bug has been marked as a duplicate of https://bugzilla.novell.com/show_bug.cgi?id=MONO77869 *** This bug was marked DUPLICATE in the database it was moved from. Changing resolution to "MOVED"