Bugzilla – Bug 318420
[PATCH] CS0139 required when continue statement has no enclosing loop
Last modified: 2007-09-15 21:24:23 UTC
---- Reported by atsushi@ximian.com 2005-07-01 02:54:31 MST ---- mcs does not report CS0139 error for "continue" statement that is not enclosed in a loop. public class Test { public static void Foo (char c) { switch (char.GetUnicodeCategory (c)) { default: if (c == 'a') continue; System.Console.WriteLine (); break; } } } Actual Results: no compilation error (except for CS5001 Main() not found). Expected Results: $ csc continue-without-loop.cs -nologo continue-without-loop.cs(8,5): error CS0139: No enclosing loop out of which to break or continue How often does this happen? consistently. Additional Information: At first I thought it is caused by some kind of optimization, but the example code above won't result in optimization (am not so sure though). ---- Additional Comments From atsushi@ximian.com 2005-08-22 08:57:39 MST ---- Created an attachment (id=168204) proposed fix ---- Additional Comments From miguel@ximian.com 2005-08-23 15:58:10 MST ---- martin, please review patch ---- Additional Comments From rharinath@novell.com 2005-08-26 07:51:05 MST ---- The patch looks OK. ---- Additional Comments From atsushi@ximian.com 2005-08-29 02:25:58 MST ---- applied (r49054). Imported an attachment (id=168204) Unknown operating system unknown. Setting to default OS "Other".