[Mono-bugs] [Bug 50875][Nor] New - warning CS0219 (-warn:4)

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Wed, 12 Nov 2003 15:26:23 -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 polak@gnu.org.

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

--- shadow/50875	2003-11-12 15:26:23.000000000 -0500
+++ shadow/50875.tmp.26210	2003-11-12 15:26:23.000000000 -0500
@@ -0,0 +1,52 @@
+Bug#: 50875
+Product: Mono/MCS
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: Misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: polak@gnu.org               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: warning CS0219 (-warn:4)
+
+mcs -warn:4 (-warn:3) produces the following warning:
+
+ test.cs(14) warning CS0219: The variable `o' is assigned but its value is
+never used
+
+while compiling for instance this `test.cs' below:
+
+using System;
+
+class Test
+{
+	public static void Main ()
+	{
+		int x;
+		Foo (out x);
+		Console.WriteLine ("x: " + x);
+	}
+
+	static void Foo (out int x)
+	{
+		object o = "abc";
+		try {
+			// this should generate
+			// an exception
+			x = Convert.ToInt32 (o);
+		}
+		catch (Exception) {
+			// x = something; is missing!
+			return;
+		}
+	}
+}
+
+Of course mcs shouldn't warn about that.