[Mono-bugs] [Bug 79940][Nor] New - Constraints not inherited in generic virtual function

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Wed Nov 15 05:32:39 EST 2006


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by josephg at gmail.com.

http://bugzilla.ximian.com/show_bug.cgi?id=79940

--- shadow/79940	2006-11-15 05:32:39.000000000 -0500
+++ shadow/79940.tmp.29145	2006-11-15 05:32:39.000000000 -0500
@@ -0,0 +1,64 @@
+Bug#: 79940
+Product: Mono: Compilers
+Version: unspecified
+OS: All
+OS Details: GNU/Linux
+Status: NEW   
+Resolution: 
+Severity: Unknown
+Priority: Normal
+Component: C#
+AssignedTo: rharinath at novell.com                            
+ReportedBy: josephg at gmail.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Constraints not inherited in generic virtual function
+
+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


More information about the mono-bugs mailing list