[Mono-bugs] [Bug 69195][Nor] New - variable assignation for CS0165 incorrectly computed on conditional expressions

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Sun, 7 Nov 2004 04:15:29 -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 atsushi@ximian.com.

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

--- shadow/69195	2004-11-07 04:15:29.000000000 -0500
+++ shadow/69195.tmp.22370	2004-11-07 04:15:29.000000000 -0500
@@ -0,0 +1,49 @@
+Bug#: 69195
+Product: Mono: Compilers
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: C#
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: atsushi@ximian.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: variable assignation for CS0165 incorrectly computed on conditional expressions
+
+For CS0165, all local variables are checked if it is initialized or not
+before being referenced. There is a bug around it when we have complex
+expression formalized as
+
+x && (a = b) == c || a (where a is unbound variable)
+
+See the example below:
+
+using System;
+
+public class Test
+{
+        public static string Foo {
+                get {
+                        string s;
+                        if (0 == 1 && (s = "") == "a" || s == "")
+                                return s;
+                        return " ";
+                }
+        }
+}
+
+Actual Results (mcs):
+No CS0165 error (error CS5001: Program cs0165.exe does not have an entry
+point defined).
+
+Expected Results (csc):
+cs0165.cs(8,37): error CS0165: Use of unassigned local variable 's'
+
+How often does this happen? 
+consistently.