[Mono-bugs] [Bug 75321][Wis] New - Private variable assigned reference value but otherwise not used flagged as warning

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Sun Jun 19 22:07:48 EDT 2005


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 claytonharbour at sporadicism.com.

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

--- shadow/75321	2005-06-19 22:07:48.000000000 -0400
+++ shadow/75321.tmp.9880	2005-06-19 22:07:48.000000000 -0400
@@ -0,0 +1,69 @@
+Bug#: 75321
+Product: Mono: Compilers
+Version: 1.1
+OS: 
+OS Details: both Win32 and Linux
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: C#
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: claytonharbour at sporadicism.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Private variable assigned reference value but otherwise not used flagged as warning
+
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+
+
+Steps to reproduce the problem:
+1. Create a class HelloWorld.cs with the following code
+
+using System;
+
+namespace HelloWorld {
+    public class MainClass {
+        readonly string _myPrivateVar;
+
+        // if _myPrivateVar is assigned a constant value this fails
+        //  with warn as error, but if it is passed in a value then 
+        //  CS0169 is not thrown
+        public MainClass (string myVar) {
+            _myPrivateVar = myVar;
+        }
+        public static void Main(string[] args) {
+            Console.WriteLine("HelloWorld");
+        }
+    }
+}
+
+2. Compile using mcs: 
+
+"c:\Program Files\Mono-1.1.8\bin\mcs" /fullpaths /debug "/define:DEBUG"
+"/define:TRACE" /nologo "/target:exe"
+"/out:E:\test\mono\bug-1\Output\HelloWorld.exe" /warnaserror
+"E:\test\mono\bug-1\HelloWorld.cs"
+
+Actual Results: Outputs warning: "MainClass._myPrivateVar' is never used"
+
+
+Expected Results: No warning expected.
+
+Using csc:
+
+csc /fullpaths /debug "/define:DEBUG" "/define:TRACE" /nologo "/target:exe"
+"/out:E:\test\mono\bug-1\Output\HelloWorld.exe" /warnaserror
+"E:\test\mono\bug-1\HelloWorld.cs"
+ 
+- no warning/ error
+
+How often does this happen? Always
+
+
+Additional Information: This seems to have been introduced sometime between
+1.1.4 and 1.1.8 (and possibly in 1.1.7 as well)


More information about the mono-bugs mailing list