blob: b1b5319ae7af949a9ebefefdb1a6d0861bf09781 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
// #77358
using System;
public class Container<T>
where T : IComparable<T>
{
}
public class ReferenceType : IComparable<ReferenceType>
{
public int value;
public int CompareTo (ReferenceType obj)
{
return 0;
}
};
public struct MyValueType : IComparable<MyValueType>
{
public int value;
public int CompareTo (MyValueType obj)
{
return 0;
}
};
public class Test
{
public static void Main ()
{
// Compilation succeeds, constraint satisfied
new Container<ReferenceType> ();
// Compilation fails, constraint not satisfied according to mcs,
// the unmodified testcase compiles successfully with csc
new Container<MyValueType> ();
}
};
|