consulo-csharp icon indicating copy to clipboard operation
consulo-csharp copied to clipboard

Implicit cast bug with float and generic parameter

Open VISTALL opened this issue 8 years ago • 0 comments


namespace implicitCast {

	public class BBParameter<T> {
		public static implicit operator BBParameter<T>(T value) {
			return new BBParameter<T>();
		}
	}
}

using implicitCast;

namespace implCast {

	public class TestMe {
		private BBParameter<float> test = 1;  // error here - int can't cast to float


	}
}

VISTALL avatar Dec 01 '17 11:12 VISTALL