Bugzilla – Bug 324319
[GMCS] gmcs generates invalid il for null a : class constraint
Last modified: 2009-01-28 12:38:06 UTC
---- Reported by vargaz@gmail.com 2007-05-16 15:48:43 MST ---- Testcase: ====================================================================== using System; public class Tests { public virtual ServiceType GetService<ServiceType>(params object[] args) where ServiceType : class { return null; } public static int Main () { return 0; } } ======================================================================= csc generates an initobj !!ServiceType, while gmcs generates an ldnull, and PEVerify flags this as invalid IL. ---- Additional Comments From rharinath@novell.com 2007-05-18 06:07:54 MST ---- Hmm. That's strange. The 'ldnull' verifiability rule says: The ldnull instruction is always verifiable, and produces a value that verification considers compatible with any other reference type. Does that mean that verification doesn't take constraints into account? Unknown operating system unknown. Setting to default OS "Other".
*** Bug 448558 has been marked as a duplicate of this bug. ***
Fixed in trunk by emitting extraneous unbox.any
*** Bug 415314 has been marked as a duplicate of this bug. ***