[Mono-bugs] [Bug 67048][Nor] New - mcs produces warnings where csc does not

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Wed, 29 Sep 2004 02:24:33 -0400 (EDT)


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 mathpup@mylinuxisp.com.

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

--- shadow/67048	2004-09-29 02:24:33.000000000 -0400
+++ shadow/67048.tmp.1106	2004-09-29 02:24:33.000000000 -0400
@@ -0,0 +1,66 @@
+Bug#: 67048
+Product: Mono: Compilers
+Version: unspecified
+OS: SUSE 9.0
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: C#
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: mathpup@mylinuxisp.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: mcs produces warnings where csc does not
+
+Description of Problem:
+
+Both mcs and csc emit a warning CS0219 (at level 3) when a primitive type 
+variable is declared and assigned but never otherwise used. However, mcs 
+also emits the warning when the variable is a user-defined class or 
+struct, whereas csc does not emit such a warning.
+
+The program below demonstrates the difference. csc emits warnings when 
+the variable has type int, but not for the case where the variable is a 
+class.
+
+
+class Testing
+{
+	public static void Main()
+	{
+
+        // .NET csc does not warn about this case
+		MyClass m;
+		m = new MyClass();
+
+        // But it does warn about this one
+        int n;
+        n = new int();
+    }
+}
+
+
+class MyClass {}
+
+Steps to reproduce the problem:
+1. mcs -w:4 test.cs
+
+
+
+Actual Results:
+
+
+
+
+Expected Results:
+
+k.cs(14,13): warning CS0219: The variable 'n' is assigned but its value 
+is never used
+
+How often does this happen? 
+
+Always