Beef icon indicating copy to clipboard operation
Beef copied to clipboard

Incorrect "out parameter must be assigned" error

Open disarray2077 opened this issue 1 year ago • 0 comments

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: https://github.com/beefytech/Beef/issues/1870 Tested with: https://github.com/beefytech/Beef/commit/aa4f9f7dfa8f2ad81a6807b87192516d0ce72a1a

disarray2077 avatar May 02 '24 23:05 disarray2077