[Mono-bugs] [Bug 43367][Wis] New - calling overloaded methods with varargs fails
bugzilla-daemon@rocky.ximian.com
bugzilla-daemon@rocky.ximian.com
Tue, 20 May 2003 07:35:02 -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 ianm@activestate.com.
http://bugzilla.ximian.com/show_bug.cgi?id=43367
--- shadow/43367 Tue May 20 07:35:02 2003
+++ shadow/43367.tmp.14274 Tue May 20 07:35:02 2003
@@ -0,0 +1,58 @@
+Bug#: 43367
+Product: Mono/MCS
+Version: unspecified
+OS:
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Wishlist
+Component: Misc
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: ianm@activestate.com
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: calling overloaded methods with varargs fails
+
+Description of Problem:
+when attempting to call overloaded methods that use variable argument lists
+ the compiler reports an Ambiguous call error ( CS0121 ).
+the following code sample demonstrates this behaviour:
+
+using System;
+
+public class Harness {
+ public static void Main( string[] args ) {
+ MonoTest2 test = new MonoTest2();
+ test.method1("some message" , "some string");
+ }
+}
+
+public class MonoTest
+{
+ public virtual void method1( string message, params object[] args) {
+
+ }
+ public void testmethod(){
+ method1( "some message" , "some string");
+ }
+ }
+
+public class MonoTest2 : MonoTest {
+
+ public override void method1(string message, params object[] args) {
+ }
+ public void testmethod2(){
+ method1( "some message " , "some string");
+ }
+}
+all calls to the overridden method1 on MonoTest2 cause the following
+compiler errors:
+MonoTest.cs(6) error CS0121: Ambiguous call when selecting function due to
+implicit casts
+MonoTest.cs(6) error CS-0006: Could not find any applicable function for
+this argument list
+
+The sample code compiles cleanly using csc.exe.