[Mono-bugs] [Bug 653710] New: Nested generics constraints produce spurious CS0413 error

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon Nov 15 13:37:33 EST 2010



           Summary: Nested generics constraints produce spurious CS0413
    Classification: Mono
           Product: Mono: Compilers
           Version: 2.8.x
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: C#
        AssignedTo: msafar at novell.com
        ReportedBy: tom.philpot at logos.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---

User-Agent:       Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US;
rv: Gecko/20100914 Firefox/3.6.10

The following code compiled with a warning on Mono 2.7 (as of 147679)  but has 
an error in 2.8. The code also compiles cleanly on .NET 3.5

namespace Application
public class Z {}

public class A<X, Y>
where Y : Z
where X : Y
protected void SomeOperation(Y y)
X x = y as X;

public class Foo { public static void Main() {} }

/opt/mono-2.8/bin/gmcs CS0413Regression.cs
CS0413Regression.cs(12,33): error CS0413: The `as' operator cannot be used with
a non-reference type parameter `X'. Consider adding `class' or a reference type
Compilation failed: 1 error(s), 0 warnings

/opt/mono-r147679/bin/gmcs CS0413Regression.cs
CS0413Regression.cs(12,27): warning CS0219: The variable `x' is assigned but
its value is never used
Compilation succeeded - 1 warning(s)

Reproducible: Always

Steps to Reproduce:
1. Compile the above code on Mono 2.8

Expected Results:  
Should compile with the same warning as Mono 2.7

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