[Mono-bugs] [Bug 38961][Wis] New - Flow analysis is lacking for 'out' assignment checking
bugzilla-daemon@rocky.ximian.com
bugzilla-daemon@rocky.ximian.com
Sun, 2 Mar 2003 06:31:44 -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 dick@ximian.com.
http://bugzilla.ximian.com/show_bug.cgi?id=38961
--- shadow/38961 Sun Mar 2 06:31:44 2003
+++ shadow/38961.tmp.29983 Sun Mar 2 06:31:44 2003
@@ -0,0 +1,52 @@
+Bug#: 38961
+Product: Mono/MCS
+Version: unspecified
+OS: other
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Wishlist
+Component: Misc
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: dick@ximian.com
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Flow analysis is lacking for 'out' assignment checking
+
+If a method has an 'out' parameter, and the assignment logic spans more
+than one conditional, mcs gets confused and thinks the out parameter hasn't
+been assigned.
+
+
+public class foo {
+ public static void blah(int which, out int wibble) {
+ int other;
+
+ if(which==0) {
+ other=0;
+ wibble=0;
+ } else {
+ other=1;
+ }
+
+ if(other==1) {
+ wibble=1;
+ }
+ }
+
+ public static void Main() {
+ int wibble;
+
+ blah(1, out wibble);
+ }
+}
+
+
+
+:; mcs unused.cs
+unused.cs(3) error CS0177: The out parameter `wibble' must be assigned
+before control leave the current method.
+Compilation failed: 1 error(s), 0 warnings