Bug 17920 - Compiler does not catch error on invalid switch fall-through
Summary: Compiler does not catch error on invalid switch fall-through
Alias: None
Product: Compilers
Classification: Mono
Component: C# (show other bugs)
Version: 3.2.x
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Marek Safar
Depends on:
Reported: 2014-02-21 02:24 UTC by Brett Ernst
Modified: 2014-02-21 03:46 UTC (History)
1 user (show)

See Also:
Is this bug a regression?: ---
Last known good build:


Description Brett Ernst 2014-02-21 02:24:12 UTC
Description of Problem:

The code below should produce a compiler error, but it doesn't. Note how one switch case falls through to the next.

using System;

namespace tmp {
	public class Foo {
		public Foo (int i) {
			switch (i) {
				case 1:
					i = 3;
					throw new NotSupportedException("bar");

	class MainClass {
		public static void Main (string[] args) {

Actual Results:
The code compiles.

Expected Results:
It should fail with an error like: Control cannot fall through from one case label ('case 1:') to another
(from VS)

How often does this happen? 
Every time

Additional Information:
Comment 1 Marek Safar 2014-02-21 03:46:08 UTC
Already fixed in mono 3.2.7

Note You need to log in before you can comment on or make changes to this bug.