This project is read-only.

Compiler ignores "Action" overloads in the presence of "Func" overloads


void M(Action m) { M(Console.Beep); }
void M(Func<int> m) { M(Console.Read); }
With Roslyn, this reports exactly one error: void System.Console.Beep()' has the wrong return type.
Remove the first invocation and it will compile and run successfully.

Without Roslyn, it reports 3 errors (both invocations show ambiguous overloads, and the second parameter shows wrong return type.

void M(Func<string> m) { M(Console.Read); }
And Roslyn will report three "The call is ambiguous between the following methods or properties: M(System.Action) and M(System.Func<int>)" errors, and no "wrong return type" errors.

It looks like the compiler completely ignores the Action overload, until a different overload resolution failure occurs (adding the third overload).