[Mono-bugs] [Bug 30171][Nor] New - ref/out overloading mismatch

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
11 Sep 2002 11:15:51 -0000


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 lupus@ximian.com.

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

--- shadow/30171	Wed Sep 11 07:15:51 2002
+++ shadow/30171.tmp.26568	Wed Sep 11 07:15:51 2002
@@ -0,0 +1,45 @@
+Bug#: 30171
+Product: Mono/MCS
+Version: unspecified
+OS: other
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: Misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: lupus@ximian.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: ref/out overloading mismatch
+
+The following program should not compile, but it does with mcs on both
+runtimes.
+using System;
+
+class T {
+        static void stuff (out object o) {
+                o = 2;
+        }
+        static void stuff2 (ref object o) {
+                o = 2;
+        }
+        static void Main () {
+                object o = 1;
+                stuff (ref o);
+                stuff2 (out o);
+        }
+}
+Note: ref must match with ref, out with out.
+csc gives the following errors:
+ref-out.cs(12,3): error CS1502: The best overloaded method match for
+'T.stuff(out object)' has some invalid arguments
+ref-out.cs(12,14): error CS1503: Argument '1': cannot convert from 'ref
+object' to 'out object'
+ref-out.cs(13,3): error CS1502: The best overloaded method match for
+'T.stuff2(ref object)' has some invalid arguments
+ref-out.cs(13,15): error CS1503: Argument '1': cannot convert from 'out
+object' to 'ref object'