Bug 311894 (MONO36323) - mcs incorrect CS0161 when using switch with return in while
Summary: mcs incorrect CS0161 when using switch with return in while
Status: RESOLVED MOVED
Alias: MONO36323
Product: Mono: Compilers
Classification: Mono
Component: C# (show other bugs)
Version: unspecified
Hardware: Other Other
: P3 - Medium : Enhancement
Target Milestone: ---
Assignee: Mono Bugs
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-01-05 22:50 UTC by Jeroen Janssen
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

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Wiest 2007-09-15 18:05:29 UTC


---- Reported by japj@xs4all.nl 2003-01-05 15:50:05 MST ----

Please fill in this template when reporting a bug, unless you know what you
are doing.
Description of Problem:


Steps to reproduce the problem:
1. Try to compile the following example:
class Test1
{
	public int Test()
	{
		int var1=0;
		while(true)
		{
			switch (var1)
			{
				case 5:
					return 10;
				default:
					var1++;
					break;
			}
		}
	}
	
	public static void Main()
	{
	
	}
}


Actual Results:

japj@debian:~/mono$ mcs test2.cs
test2.cs(3) error CS0161: Not all code paths return a value
Compilation failed: 1 error(s), 0 warnings


Expected Results:

Compilation to succeed

How often does this happen? 
Always

Additional Information:

I found this when trying to get janet compiling with mcs



---- Additional Comments From miguel@ximian.com 2003-01-07 16:16:00 MST ----



*** This bug has been marked as a duplicate of https://bugzilla.novell.com/show_bug.cgi?id=MONO36155 ***


Unknown operating system unknown. Setting to default OS "Other".
This bug was marked DUPLICATE in the database it was moved from.
    Changing resolution to "MOVED"