[Mono-bugs] [Bug 52967][Wis] New - Incorrect compile error: Use of unassigned local variable
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Fri, 16 Jan 2004 18:43:27 -0500 (EST)
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 kelvin.ho@kawai.ca.
http://bugzilla.ximian.com/show_bug.cgi?id=52967
--- shadow/52967 2004-01-16 18:43:27.000000000 -0500
+++ shadow/52967.tmp.15820 2004-01-16 18:43:27.000000000 -0500
@@ -0,0 +1,73 @@
+Bug#: 52967
+Product: Mono/Compilers
+Version: unspecified
+OS:
+OS Details: XP SP1
+Status: NEW
+Resolution:
+Severity:
+Priority: Wishlist
+Component: C#
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: kelvin.ho@kawai.ca
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Incorrect compile error: Use of unassigned local variable
+
+Description of Problem:
+Incorrect compile error: Use of unassigned local variable
+
+Steps to reproduce the problem:
+1. mcs k3.cs
+
+k3:.cs
+using System;
+
+public class K3
+{
+ public K3()
+ {
+ }
+
+ public Int32 Test( Int32 z )
+ {
+ Int32 x;
+ Int32 y = 1;
+
+ switch( y )
+ {
+ case 1:
+ {
+ x = 1;
+ break;
+ }
+ default:
+ {
+ return 0;
+ }
+ }
+
+ return x;
+ }
+
+ public static void Main()
+ {
+ K3 k3 = new K3();
+ k3.Test( 10 );
+ }
+}
+
+Actual Results:
+k3.cs(27) error CS0165: Use of unassigned local variable `x'
+Compilation failed: 1 error(s), 0 warnings
+
+Expected Results:
+.NET csc is OK with this program.
+
+
+How often does this happen?
+Every time.
+
+Additional Information: