[Mono-bugs] [Bug 81495][Min] New - return should be like throw in not requiring a break afterwards in a switch

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Mon Apr 30 13:16:32 EDT 2007


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by vgiszpenc at dsci.com.

http://bugzilla.ximian.com/show_bug.cgi?id=81495

--- shadow/81495	2007-04-30 13:16:32.000000000 -0400
+++ shadow/81495.tmp.11575	2007-04-30 13:16:32.000000000 -0400
@@ -0,0 +1,50 @@
+Bug#: 81495
+Product: Mono: Compilers
+Version: 1.2
+OS: All
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Minor
+Component: C#
+AssignedTo: rharinath at novell.com                            
+ReportedBy: vgiszpenc at dsci.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: return should be like throw in not requiring a break afterwards in a switch
+
+Description of Problem:
+The break statement is not always allowed to be replaced by something else
+that jumps out.  Any of the jump keywords (return, continue, throw) should
+behave the same way in a switch since they cause unreachable code.
+
+Steps to reproduce the problem:
+class foo
+{
+  int bar(int i)
+  {
+    switch(i)
+    {
+      case 1:
+        return 1;
+        //unreachable code but compiler requires next line???
+        break;
+      default:
+        throw new Exception();
+        //no break needed here Yippee
+    }
+  }
+}
+
+Actual Results:
+Control cannot fall through from one case to another (CS0163)
+
+Expected Results:
+You might complain about unreachable code as a warning though that may be
+overkill.
+
+How often does this happen? 
+Always


More information about the mono-bugs mailing list