Bug 46190 - Overload resolution fails in a case where methods use a named parameter in different positions
Summary: Overload resolution fails in a case where methods use a named parameter in di...
Status: RESOLVED FIXED
Alias: None
Product: Compilers
Classification: Mono
Component: C# (show other bugs)
Version: 4.6.0 (C8)
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Marek Safar
URL:
Depends on:
Blocks:
 
Reported: 2016-10-31 15:28 UTC by Chris F Carroll
Modified: 2016-11-04 17:39 UTC (History)
1 user (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments

Description Chris F Carroll 2016-10-31 15:28:11 UTC
mcs v4.6.1.0 fails to identify an applicable function member when one exists, in the short code sample below.
The code sample compiles and runs under .Net 4 on Windows but does not compile under mcs.
-----------------------
Expected: Successful compilation
Actual: "error CS1744: Named argument `paramNamed' cannot be used for a parameter which has positional argument specified"
-----------------------
using System;
namespace BugDemos
{
 internal class Program
 {
   public static void Main(string[] args)
   {
    Method(1, 2, paramNamed: 3);
    //Output on .Net 4 is:
    //
    //Resolved to: Method(int p1, int p2, object paramNamed)
    //
   }
   static void Method(int p1, int paramNamed, int p3) { Console.WriteLine("Resolved to: Method(int p1, int paramNamed, int p3)");}
   static void Method(int p1, int p2, object paramNamed) { Console.WriteLine("Resolved to: Method(int p1, int p2, object paramNamed)");}
 }
}
Comment 1 Marek Safar 2016-11-04 17:39:18 UTC
Fixed in master and Mono 4.8

Note You need to log in before you can comment on or make changes to this bug.