https://bugzilla.novell.com/show_bug.cgi?id=424896


           Summary: SLE ignores type argument constraints
           Product: Mono: Class Libraries
           Version: SVN
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Sys.Core
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]
         QAContact: [email protected]
          Found By: ---


using System;
using System.Linq;
using System.Linq.Expressions;

class Program
{
    static void Main()
    {
        Test<S>();
    }

    static void Test<T>() where T : I
    {       
        Expression<Func<T, int>> e = x => x.SetX();
        e.Compile()(default (T)); 
    }
}

interface I
{
    int X { get; }
    int SetX();
}

struct S : I
{
    public int X { get; private set; }
    public int SetX()
    {
        X = 7;
        return 0;
    }
}


1. compile
2. run

Expected: no exception

The real question is why this does not work with properties.


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
_______________________________________________
mono-bugs maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-bugs

Reply via email to