[Mono-bugs] [Bug 424896] New: SLE ignores type argument constraints

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Sep 9 14:58:33 EDT 2008


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: jbevain at novell.com
        ReportedBy: msafar at novell.com
         QAContact: mono-bugs at lists.ximian.com
          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.


More information about the mono-bugs mailing list