Beef icon indicating copy to clipboard operation
Beef copied to clipboard

[Crash] Segfault when calling GetEnumerator on IEnumerable with SizedArray and zero elements

Open farism opened this issue 3 years ago • 0 comments

using System;
using System.Collections;

namespace TryBeef;

class Program {
	public static void Main(String[] args) {
		void Fn<T, U>(T a) where T : IEnumerable<U>
		{
			Console.WriteLine("{}", a.GetEnumerator());
		}

		Console.WriteLine("{}", int[]().GetEnumerator());

		Fn(int[](1,2,3));

		// Fn(int[]()); // segfault
	}
}

https://trybeef.netlify.app/#/Yoy8bi

get_enumerator_generic_zero_sizedarray.zip

farism avatar Oct 23 '22 02:10 farism