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

Incorrect error about uninitialized out parameter in extern local function #49500

Closed
TessenR opened this issue Nov 19, 2020 · 0 comments · Fixed by #49860
Closed

Incorrect error about uninitialized out parameter in extern local function #49500

TessenR opened this issue Nov 19, 2020 · 0 comments · Fixed by #49860
Assignees
Milestone

Comments

@TessenR
Copy link

TessenR commented Nov 19, 2020

Version Used:

Branch master (18 Nov 2020)
Latest commit 823039e by David Wengier:
Create an unsafe method from a local function when necessary (#49389)

Steps to Reproduce:

using System.Runtime.InteropServices;

class C
{
  void M()
  {
    [DllImport("asdf")]
    static extern void Local(out int x); // error CS0177
  }
    
  [DllImport("asdf")]
  static extern void Method(out int x); // no errors
}

Expected Behavior:
No errors

Actual Behavior:
error CS0177: The out parameter 'x' must be assigned to before control leaves the current method is reported for Local but not for Method

Note that as the function is extern it isn't allowed to have a body so it's impossible to fix the error

@Dotnet-GitSync-Bot Dotnet-GitSync-Bot added Area-Compilers untriaged Issues and PRs which have not yet been triaged by a lead labels Nov 19, 2020
@RikkiGibson RikkiGibson self-assigned this Nov 21, 2020
@jaredpar jaredpar removed the untriaged Issues and PRs which have not yet been triaged by a lead label Dec 1, 2020
@jaredpar jaredpar added this to the 16.9 milestone Dec 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants