[Mono-devel-list] BUG: Static ToString method problem...

Vadim B. Guzev vguzev at yandex.ru
Sat Jul 3 11:53:13 EDT 2004


Hello,


I've found a bug in Mono 1.0.
Look at the following files a.cs and q.cs:
8<------------------------------------------------
[vadim at skif static_tostring]$ cat a.cs
using System;
using Q;

public class B {
 public static void Main( string[] args ) {
  Console.WriteLine( A.ToString() );
 }
}
[vadim at skif static_tostring]$ cat q.cs
namespace Q {
 public class A {
  public static new string ToString() {
   return "Hello world!";
  }
 }
}
8<------------------------------------------------

Try to compile them - you'll see the following:

8<------------------------------------------------
[vadim at skif static_tostring]$ mcs /t:library q.cs
Compilation succeeded
[vadim at skif static_tostring]$ mcs /r:q.dll a.cs
a.cs(6) error CS0121: Ambiguous call when selecting function due to implicit casts
a.cs(6) error CS8006: Could not find any applicable function for this argument list
Compilation failed: 2 error(s), 0 warnings
8<------------------------------------------------

The same example works perfectly on MS .Net 1.0. I think that it's a
problem with C# compiler as it was in bug http://bugzilla.ximian.com/show_bug.cgi?id=52931

Here's my system info:
8<------------------------------------------------
Linux skif 2.4.25 #2 SMP Fri Apr 23 14:03:00 MSD 2004 i686 athlon i386 GNU/Linux
gcc (GCC) 3.2.2 20030222 (Red Hat Linux 3.2.2-5)
Mono JIT compiler version 1.0, (C) 2002-2004 Novell, Inc and Contributors. www.go-mono.com
        TLS:           normal
        GC:            Included Boehm (with typed GC)
        SIGSEGV      : normal
        Globalization: ICU
8<------------------------------------------------

I've posted it here: http://bugzilla.ximian.com/show_bug.cgi?id=61128


Best regards,
Vadim B. Guzev
http://u.pereslavl.ru/~vadim/MCSharp/




More information about the Mono-devel-list mailing list