C# MonoTouch method overload with Generic method and Non-generic method with default argument
===

..and a side of fries.

I have a codebase that I'm compiling for both Windows and MonoTouch. In the wee hours of the morning I coded something like this contrived example which compiles on MonoTouch but fails on Windows:

    void Run()
    {
        // okay on both
        exec("hello", 1);

        // okay on MonoTouch
        // compiler error on windows
        exec("hello");
    }

    interface IFace { void foo(); }

    void exec(string s, int n=0) 
    { 
        Console.Write("A");  
    }
    void exec<T>(T t) where T:IFace
    { 
        Console.Write("B");
    }

On MonoTouch, this compiles and runs, printing:
    
    AA

On Windows, this example gives a compile-time error:

`The type 'string' cannot be used as type parameter 'T' in the generic type or method 'App.Program.exec<T>(T)'. There is no implicit reference conversion from 'string' to 'App.Program.IFace'.`

The C# spec on [7.4.2 Overload Resolution][or] says that an [7.4.2.1 Applicable function member][afm] must have an identical number of arguments:

> The number of arguments in A is identical to the number of parameters in the function member declaration. [7.4.2.1][afm]

So it would seem the MonoTouch compiler is considering default arguments when searching for applicable function members, but the Windows compiler is not. So the candidate function members are:

    // exec with no default parameters. not applicable because no int supplied
    void exec(string,int);
    
    // exec with default value for the second parameter. 
    // only considered on MonoTouch.
    void exec(string,int=0);

    // generic exec with string as the type, which is invalid
    // due to the IFace constraint. Invalid on both platforms.
    void exec<string>(string) : where T:IFace; 

So, is this a bug in the Applicable Function Member search on MonoTouch, or should the Windows compiler consider the default-parameterized non-generic method as valid?

Cheers,
cm

 [or]: http://msdn.microsoft.com/en-us/library/aa691336(v=vs.71).aspx
 [afm]: http://msdn.microsoft.com/en-us/library/aa691337(v=vs.71)

