Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delegate types are only synthesized for lambdas with parameter types and return type that are valid type arguments #55217

Closed
cston opened this issue Jul 29, 2021 · 1 comment · Fixed by #57295

Comments

@cston
Copy link
Member

cston commented Jul 29, 2021

Delegates are currently only synthesized for lambda expressions and method groups when all parameter types and return type are valid as generic type arguments.

class Program
{
    unsafe static void Main()
    {
        var d1 = (ref int i) => { };  // ok
        var d2 = (int* p) => { };     // CS8917: The delegate type could not be inferred.
    }
}
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Compilers untriaged Issues and PRs which have not yet been triaged by a lead labels Jul 29, 2021
@cston cston self-assigned this Jul 29, 2021
@jaredpar jaredpar added Bug and removed untriaged Issues and PRs which have not yet been triaged by a lead labels Aug 2, 2021
@jaredpar jaredpar added this to the 17.0 milestone Aug 2, 2021
@jaredpar
Copy link
Member

jaredpar commented Aug 2, 2021

I presume this includes ref struct as well hence Span<T> would be impacted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment