Bugzilla – Bug 322641
[GMCS] Constraints not inherited in generic virtual function
Last modified: 2007-09-15 21:24:23 UTC
---- Reported by josephg@gmail.com 2006-11-15 05:32:38 MST ---- Description of Problem: Overridden functions should inherit all constraints from the function they override. When using generics, these constraints can include interfaces allowing overridden functions to call interface methods on arguments. This does not currently function. Test case: namespace Test { public interface MyInterface { void Func(); } public class Base { public virtual void Func<T>(T val) where T : MyInterface { val.Func(); // OK } } public class Child : Base { public override void Func<T>(T val) { val.Func(); // does not compile } } } Actual Results: $ gmcs inherit_constraints.cs inherit_constraints.cs(22,8): error CS0117: `T' does not contain a definition for `Func' Expected Results: Successful compilation Additional Information: $ gmcs --version Mono C# compiler version 1.2.0.0 ---- Additional Comments From josephg@gmail.com 2006-11-15 05:33:33 MST ---- Created an attachment (id=170884) Sample program which demonstrates bug ---- Additional Comments From gert.driesen@pandora.be 2007-03-07 16:08:32 MST ---- This one's compiling just fine with SVN head. Close ? ---- Additional Comments From martin@ximian.com 2007-03-07 17:00:10 MST ---- Yes. Imported an attachment (id=170884) Unknown bug field "cf_op_sys_details" encountered while moving bug <cf_op_sys_details>GNU/Linux</cf_op_sys_details>