Bugzilla – Bug 311894
mcs incorrect CS0161 when using switch with return in while
Last modified: 2007-09-15 21:24:23 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"