[Mono-bugs] [Bug 46199][Nor] New - Wrong overloading resolution for params
bugzilla-daemon@rocky.ximian.com
bugzilla-daemon@rocky.ximian.com
Sat, 12 Jul 2003 11:27:30 -0400 (EDT)
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 sestoft@dina.kvl.dk.
http://bugzilla.ximian.com/show_bug.cgi?id=46199
--- shadow/46199 Sat Jul 12 11:27:30 2003
+++ shadow/46199.tmp.9159 Sat Jul 12 11:27:30 2003
@@ -0,0 +1,71 @@
+Bug#: 46199
+Product: Mono/MCS
+Version: unspecified
+OS:
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: Misc
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: sestoft@dina.kvl.dk
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Wrong overloading resolution for params
+
+Description of Problem:
+
+In MS CLR 1.1, the call m(1, 2) invokes m(int, int[]); in Mono
+it invokes m(int, double).
+
+The C# Language Spec 1.1.3 says that both are applicable (bcs. the
+expanded form of m(int, int[]) is m(int, int) which is not the same
+as m(int, double). But the expanded form m(int, int) of m(int,
+int[]) is better than m(int, double), and therefore the former
+should be called.
+
+This is an mcs (compiler) problem; the generated bytecode behaves
+the same under MS CLR 1.1 as under mono 0.25.
+
+Steps to reproduce the problem:
+1. Compile and run this program:
+
+using System;
+
+class MyTest {
+ public static void Main(String[] args) {
+ Console.WriteLine(m(1, 2));
+ }
+
+ public static int m(int a, double b) {
+ Console.Write("m(int, double): ");
+ return a + (int)b;
+ }
+
+ public static int m(int x0, params int[] xr) {
+ Console.Write("m(int, int[]): ");
+ int res = x0;
+ foreach (int i in xr)
+ res += i;
+ return res;
+ }
+}
+
+
+Actual Results:
+
+m(int, double): 3
+
+Expected Results:
+
+m(int, int[]): 3
+
+How often does this happen?
+
+Always, on mono 0.25 (and 0.23).
+
+
+Additional Information: