[Mono-bugs] [Bug 55704][Wis] New - mcs does not report error CS0663 properly.
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Wed, 17 Mar 2004 04:32:52 -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 rkumar@novell.com.
http://bugzilla.ximian.com/show_bug.cgi?id=55704
--- shadow/55704 2004-03-17 04:32:51.000000000 -0500
+++ shadow/55704.tmp.1647 2004-03-17 04:32:51.000000000 -0500
@@ -0,0 +1,81 @@
+Bug#: 55704
+Product: Mono: Compilers
+Version: unspecified
+OS: Red Hat 9.0
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Wishlist
+Component: C#
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: rkumar@novell.com
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: mcs does not report error CS0663 properly.
+
+Description of Problem:
+.NET docs say "it is not possible to define an overload that only differs
+by ref and out....
+the following overload declarations are invalid:
+class MyClass
+{
+ public void MyMethod(out int i) {i = 10;}
+ public void MyMethod(ref int i) {i = 10;}
+}"
+
+Steps to reproduce the problem:
+1. Try to compile following code using mcs and csc.
+
+// code
+using System;
+public class Test {
+
+ public static void Main () {
+
+ int x = 10;
+
+ do_something (ref x);
+ do_something (out x);
+ do_something (x);
+ }
+
+ static void do_something (ref int i) {
+ Console.WriteLine ("ref i: " + i);
+ i = 13;
+ }
+
+ static void do_something (int i) {
+ Console.WriteLine ("i: " + i);
+ }
+
+ static void do_something (out int i) {
+ Console.WriteLine ("out i: " + i);
+ i = 12;
+ }
+
+// static void do_something (out int i) {
+// Console.WriteLine ("out i: " + i);
+// i = 12;
+// }
+
+}
+// code
+
+Actual Results:
+mcs reports following error,
+error CS0111: Class 'Bug' already defines a member called 'do_something'
+with the same parameter types
+
+Expected Results:
+csc reports following error,
+error CS0663: 'do_something' cannot define overloaded methods which differ
+only on ref and out
+
+How often does this happen?
+Always
+
+Additional Information:
+csc reports CS0111 when we have a exact duplicate copy of a method.