[Mono-bugs] [Bug 387040] New: Compilation error with explicit interface implementations and constraints

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue May 6 02:47:47 EDT 2008


           Summary: Compilation error with explicit interface
                    implementations and constraints
           Product: Mono: Compilers
           Version: SVN
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: C#
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: sanxiyn at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---

SVN 102582.


public class RuleBuilder<T> where T : class {}

public interface IDynamicObject {
    RuleBuilder<T> GetRule<T>() where T : class;

public class RubyMethod : IDynamicObject {
    RuleBuilder<T> IDynamicObject.GetRule<T>() /* where T : class */ {
        return new RuleBuilder<T>();


Test.cs(8,5): error CS0452: The type `T' must be a reference type in order to
use it as type parameter `T' in the generic type or method `RuleBuilder<T>'.

If you uncomment the constraint:

Test.cs(8,35): error CS0460: `RubyMethod.IDynamicObject.GetRule<T>()': Cannot
specify constraints for overrides or explicit interface implementation methods

Compiles fine on csc.

Blocks compiling IronRuby SVN r101.

Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.

More information about the mono-bugs mailing list