[Mono-bugs] [Bug 50841][Nor] New - mcs doesn't flag CS0177 in presence of try/catch

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Sat, 7 Feb 2004 12:41:28 -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 miguel@ximian.com.

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

--- shadow/50841	2004-02-07 12:41:28.000000000 -0500
+++ shadow/50841.tmp.21449	2004-02-07 12:41:28.000000000 -0500
@@ -0,0 +1,64 @@
+Bug#: 50841
+Product: Mono/Compilers
+Version: unspecified
+OS: All
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: Unknown
+Priority: Normal
+Component: C#
+AssignedTo: martin@ximian.com                            
+ReportedBy: gonzalo@ximian.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: mcs doesn't flag CS0177 in presence of try/catch
+
+mcs -t:library bug.cs
+---bug.cs---
+using System;
+ 
+class C
+{
+        public bool Method (out int var)
+        {
+                try {
+                        var = Int32.Parse ("12");
+                        return true;
+                } catch {
+                        return false;
+                }
+        }
+}
+------------
+
+Actual results:
+Compilation succeeded
+
+Expected results:
+CS0177: The out parameter 'var' must be assigned before control leaves the
+current method
+
+Additional comments:
+
+May be this should be another bug by itself, but doing the same with:
+using System;
+
+class C
+{
+	public bool Method (out int var)
+	{
+		return true;
+	}
+}
+
+yields:
+bug.cs(6) error CS0177: The out parameter `var' must be assigned before
+control leave the current method.
+bug.cs(5) error CS0177: The out parameter `var' must be assigned before
+control leave the current method.
+Compilation failed: 2 error(s), 0 warnings
+
+Yes, 2 warnings.