Bug 11526 - mcs is not raising an error for an uninitialized local
Summary: mcs is not raising an error for an uninitialized local
Alias: None
Product: Compilers
Classification: Mono
Component: C# ()
Version: unspecified
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Marek Safar
Depends on:
Reported: 2013-04-02 17:55 UTC by Bojan Rajkovic [MSFT]
Modified: 2013-11-21 08:54 UTC (History)
1 user (show)

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

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Bojan Rajkovic [MSFT] 2013-04-02 17:55:50 UTC
The following small testcase fails on csc with the following error:

switch.cs(14,24): error CS0165: Use of unassigned local variable 'trial'

using System;

class Test
	public static void Main (string[] args) {
		bool trial;
		string action = "add_trial";
		switch (action) {
			case "add_trial":
				trial = true;
				goto case "add_to_project";
			case "add_to_project":
				Console.WriteLine (trial);
			case "test":

This seems to be similar to bug 278, but I did not want to reopen such an old bug.
Comment 1 Marek Safar 2013-11-21 08:54:59 UTC
Fixed in master