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

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


I've found a bug in Mono 1.0.
Look at the following files a.cs and q.cs:
[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!";

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

[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

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:
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

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

Best regards,
Vadim B. Guzev

More information about the Mono-devel-list mailing list