Bug 318420 (MONO75433) - [PATCH] CS0139 required when continue statement has no enclosing loop
Summary: [PATCH] CS0139 required when continue statement has no enclosing loop
Status: RESOLVED FIXED
Alias: MONO75433
Product: Mono: Compilers
Classification: Mono
Component: C# (show other bugs)
Version: 1.1
Hardware: Other Other
: P3 - Medium : Normal
Target Milestone: ---
Assignee: Martin Baulig
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-07-01 09:54 UTC by Atsushi Enomoto
Modified: 2007-09-15 21:24 UTC (History)
0 users

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
proposed fix (511 bytes, patch)
2005-08-22 15:57 UTC, Thomas Wiest
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Wiest 2007-09-15 19:24:00 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".