Tue 07 Jan 2003 08:48:54 AM UTC, original submission:
When a library containing enums is compiled with mcs, cscc does not recognize the enum's members as having the correct type.
I'm going to quote from the bug report I submitted on Mono's site:
The IL that mcs produces for enums differs from that of csc. Consider, for example, the code
public class QFont
{
public enum Weight {
Light = 25, Normal = 50, DemiBold = 63, Bold = 75, Black = 87 }
}
For the enum declaration, csc produces
.class nested public auto sealed ansi Weight extends [mscorlib]System.Enum
{
.field public specialname rtspecialname int32 value__
.field public static literal valuetype QFont/Weight Light = int32(0x00000019)
.field public static literal valuetype QFont/Weight Normal = int32(0x00000032)
.field public static literal valuetype QFont/Weight DemiBold =
int32(0x0000003F)
.field public static literal valuetype QFont/Weight Bold = int32(0x0000004B)
.field public static literal valuetype QFont/Weight Black = int32(0x00000057)
}
whereas mcs produces
.class nested public auto sealed ansi Weight extends [mscorlib]System.Enum
{
.field public specialname rtspecialname int32 value__
.field public static literal int32 Light = int32(0x00000019)
.field public static literal int32 Normal = int32(0x00000032)
.field public static literal int32 DemiBold = int32(0x0000003F)
.field public static literal int32 Bold = int32(0x0000004B)
.field public static literal int32 Black = int32(0x00000057)
}
Note that the static fields have type "int32" in mcs's version but "valuetype" in csc's.
The typical effect of this problem is that cscc thinks that QFont.Weight.Bold has type int, rather than QFont.Weight! By the way, Rotor's csc does not complain about this issue. Surprisingly, it appears to be more flexible on this point.
In any case, I'm not entirely sure whose "fault" this is, but upshot is that mcs-compiled Qt.dll cannot be used with cscc.
|