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 "out parameter must be assigned" error #1966

Open
disarray2077 opened this issue May 2, 2024 · 0 comments
Open

Incorrect "out parameter must be assigned" error #1966

disarray2077 opened this issue May 2, 2024 · 0 comments

Comments

@disarray2077
Copy link
Contributor

The code below only compiles if you uncomment the line after the while loop. However, even the compiler itself knows this code is useless since it will never reach that point.

	public static bool Test(out int item)
	{
		int i = 0;
		while (true)
		{
			if (++i == 10)
			{
				item = default;
				return true;
			}
		}
		//item = 10; // WARN: Unreachable code.
	}

This issue might be related: #1870
Tested with: aa4f9f7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant