[Mono-dev] Generic Constraints Regression in 2.8
Tom Philpot
tom.philpot at logos.com
Sun Nov 14 22:16:52 EST 2010
The following code compiled with a warning on Mono 2.7 (as of 147679) but has an error in 2.8.
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 constraint
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)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20101114/3a9a92f6/attachment.html
More information about the Mono-devel-list
mailing list