Bug 28651

Summary: Invalid CS1501 error for overload with optional parameter in interface
Product: [Mono] Compilers Reporter: Alexander Köplinger <alex.koeplinger>
Component: C#Assignee: Marek Safar <masafa>
Status: RESOLVED FIXED    
Severity: normal CC: mono-bugs+mono
Priority: ---    
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Tags: Is this bug a regression?: ---
Last known good build:

Description Alexander Köplinger 2015-04-01 14:32:38 UTC
The following code generates an error when compiled with mcs:


> namespace Test
> {
>     public interface IA
>     {
>         int Foo(int x = 0);
>     }
> 
>     public class A : IA
>     {
>         public int Foo(int x)
>         {
>             return x;
>         }
> 
>         private static int Bar<T>(T x) where T : A, IA
>         {
>             return x.Foo();
>         }
> 
>         public static int Main()
>         {
>             return Bar(new A());
>         }
>     }
> }


> $ mcs /t:library test.cs 
> test.cs(17,22): error CS1501: No overload for method `Foo' takes `0' arguments
> test.cs(10,20): (Location of the symbol related to previous error)
> Compilation failed: 1 error(s), 0 warnings

Note: this was extracted from the dynamics testsuite over at dotnet/corefx
Comment 1 Marek Safar 2015-04-02 08:50:35 UTC
Fixed in master