Bug 322641 (MONO79940) - [GMCS] Constraints not inherited in generic virtual function
Summary: [GMCS] Constraints not inherited in generic virtual function
Status: RESOLVED FIXED
Alias: MONO79940
Product: Mono: Compilers
Classification: Mono
Component: C# (show other bugs)
Version: unspecified
Hardware: Other All
: P3 - Medium : Normal
Target Milestone: ---
Assignee: Martin Baulig
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-11-15 12:32 UTC by Joseph Gentle
Modified: 2007-09-15 21:24 UTC (History)
0 users

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
Sample program which demonstrates bug (366 bytes, text/plain)
2006-11-15 12:33 UTC, Thomas Wiest
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Wiest 2007-09-15 20:16:14 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>