[Mono-bugs] [Bug 77980][Nor] New - Wrong warning displayed on unassigned variables

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Sat Apr 1 08:05:58 EST 2006


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 agro1986 at gmail.com.

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

--- shadow/77980	2006-04-01 08:05:58.000000000 -0500
+++ shadow/77980.tmp.31664	2006-04-01 08:05:58.000000000 -0500
@@ -0,0 +1,57 @@
+Bug#: 77980
+Product: Mono: Compilers
+Version: 1.1
+OS: 
+OS Details: Windows XP SP2
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: C#
+AssignedTo: rharinath at novell.com                            
+ReportedBy: agro1986 at gmail.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Wrong warning displayed on unassigned variables
+
+/*
+compile with
+
+mcs [filename]
+
+using "Mono C# compiler version 1.1.13.6"
+*/
+
+class CompilerBugDemo
+{
+	static void Correct()
+	{
+		object y1; // correct: compiler reports "declared but never 
+used"
+		object x1; // correct: compiler reports "assigned but its value 
+is never used"
+		x1 = new object();
+	}
+	static object Wrong()
+	{
+		object y2; // WRONG: compiler reports "assigned but its value 
+is never used" (should be "declared but never used")
+		object x2; // correct: compiler reports "assigned but its value 
+is never used"
+		x2 = new object();
+		return null;
+	}
+	static object WrongAgain()
+	{
+		object y3; // WRONG: compiler reports "assigned but its value 
+is never used" (should be "declared but never used")
+		object x3;
+		x3 = new object();
+		return x3;
+	}
+	static void Main()
+	{
+	}
+}


More information about the mono-bugs mailing list