Bugzilla – Bug 315755
[GMCS]: rejects constraint with dependency an another constraint
Last modified: 2007-09-15 21:24:23 UTC
---- Reported by benmartin@fourthplanet.net 2004-08-12 01:14:17 MST ---- gmcs gives errors on the following code: using System; class A<T> where T: IComparable { } class B<S, T> where T: IComparable where S: A<T> { } class Driver { public static void Main() { A<int> a_int; B<A<int>, int> b_stuff; } } with the following error: cp_test5.cs(6) error CS0309: The type `T' must be convertible to `System.IComparable' in order to use it as parameter `T' in the generic type or method `A`1<T>' Compilation failed: 1 error(s), 0 warnings ---- Additional Comments From benmartin@fourthplanet.net 2004-10-08 15:37:24 MST ---- This no longer causes the above error, but instead crashes with the error: ALPHA SOFTWARE: Mono C# Compiler 1.1.1.0 for Generics Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object in <0x00134> Mono.CSharp.GenericConstraints:get_IsReferenceType () in <0x000a7> Mono.CSharp.Convert:ImplicitTypeParameterConversion (Mono.CSharp.Expression,System.Type) in <0x00045> Mono.CSharp.Convert:ImplicitReferenceConversionExists (Mono.CSharp.Expression,System.Type) in <0x00304> Mono.CSharp.Convert:ImplicitStandardConversionExists (Mono.CSharp.Expression,System.Type) in <0x0017e> Mono.CSharp.ConstructedType:CheckConstraint (Mono.CSharp.EmitContext,System.Type,Mono.CSharp.Expression,System.Type) in <0x004cb> Mono.CSharp.ConstructedType:CheckConstraints (Mono.CSharp.EmitContext,int) in <0x0014c> Mono.CSharp.ConstructedType:ResolveType (Mono.CSharp.EmitContext) in <0x00b4d> Mono.CSharp.Constraints:ResolveTypes (Mono.CSharp.EmitContext) in <0x002a6> Mono.CSharp.TypeParameter:DefineType (Mono.CSharp.EmitContext,System.Reflection.Emit.MethodBuilder,System.Reflection.MethodInfo,bool) in <0x00017> Mono.CSharp.TypeParameter:DefineType (Mono.CSharp.EmitContext) in <0x0063c> Mono.CSharp.TypeContainer:DefineType () in <0x0042a> Mono.CSharp.RootContext:ResolveTree () in <0x00c2e> Mono.CSharp.Driver:MainDriver (string[]) in <0x0001f> Mono.CSharp.Driver:Main (string[]) ---- Additional Comments From martin@ximian.com 2004-11-18 03:05:54 MST ---- Fixed in SVN, testcase is in gen-102.cs.