You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
usingSystem;M(newRS(),newRS());//M(new C(), new C());voidM<T>(Tl,Tr)whereT:IComparable<T>,allowsrefstruct{Console.WriteLine(l.CompareTo(r));}classC:IComparable<C>{publicintCompareTo(C?other)=>0;}//public struct RS : IComparable<RS>publicrefstructRS:IComparable<RS>{publicintCompareTo(RSother)=>i-other.i;privateinti=Random.Shared.Next();publicRS(){}}
throws a VerificationException in run mode:
System.Security.VerificationException: Method SharpLab.Runtime.Internal.Flow.ReportValue: type argument 'RS' violates the constraint of type parameter 'T'.
at Program.<<Main>$>g__M|0_0[T](T l, T r)
at Program.<Main>$(String[] args)
at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span`1 copyOfArgs, BindingFlags invokeAttr)
The text was updated successfully, but these errors were encountered:
The following code:
throws a VerificationException in
run mode
:The text was updated successfully, but these errors were encountered: