[Mono-bugs] [Bug 59428][Nor] New - Reachability of constant switches
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Tue, 1 Jun 2004 23:01:09 -0400 (EDT)
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 bmaurer@users.sf.net.
http://bugzilla.ximian.com/show_bug.cgi?id=59428
--- shadow/59428 2004-06-01 23:01:09.000000000 -0400
+++ shadow/59428.tmp.3221 2004-06-01 23:01:09.000000000 -0400
@@ -0,0 +1,40 @@
+Bug#: 59428
+Product: Mono: Compilers
+Version: unspecified
+OS:
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: C#
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: bmaurer@users.sf.net
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Reachability of constant switches
+
+class T {
+ static int Main ()
+ {
+ switch (1) {
+ case 1:
+ return 0;
+ default:
+ break;
+ }
+ }
+}
+
+Should compile. Since the switch value is constant, we only have to look at
+the `1' case. Even though the default case does not return it does not
+matter, as it cant be reached.
+
+`The statement list of a given switch section is reachable if the switch
+statement is reachable and at least one of the following is true: ... The
+switch expression is a constant value that matches a case label in the
+switch section.'
+
+From 15.7.2 The switch statement.