[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Fri, 14 Feb 2003 20:07:06 +1000
On Friday 14 February 2003 06:31 pm, Gopal V wrote:
> So the question is "How do I favour Enum -> Int32 conversion" while looking
> for methods ?. The conversion to Object is the right one for direct
> invocation, but is the wrong one for the Attribute case .. :-(
Actually, the Enum->Object conversion is the correct one to choose in this
case, according to csc. What it seems to do is convert the enum into a
type-0x55 serialization value (IL_META_SERIALTYPE_ENUM), which we don't
currently handle properly.
If I'm understanding it correctly, type-0x55 represents an enum constant that
is converted into a boxed object at runtime, rather than a simple integer
There are two things to be fixed: (a) recognise that it is OK to coerce a
constant to a reference type (ILTypeIsReference) in an attribute argument, as
long as regular type coercion says its OK; (b) fix the serialization code (in
multiple places) to handle reference types appropriately.
Log the bug in Savannah, with the test case, so that we can track it. Also
add the following to the FooBar class:
public static void Main2()
public static void Main3()
These also implicitly coerce to a boxed value.