[Mono-list] Bug in mcs: casting type enum to integral type

Miguel de Icaza miguel@ximian.com
26 Feb 2002 01:24:05 -0500


Hello Adam!

> Noticed another bug in the compiler.  mcs is having trouble compiling classes 
> with explicit casting of type enum to one of the integral types.  The 
> following test outlines the error.  The error I recieve is:
> 
> Unhandled exception System.NullReferenceException A null value was found 
> where an object instance was required.
> #0: 0x00001 callvirt   in Mono.CSharp.Expression::ConvertNumericExplicit 
> ([0x81d0a58] [(nil)] [0x80ecd38] )
> #1: 0x0007e call       in Mono.CSharp.Expression::ConvertExplicit 
> ([0x81d0a58] [0x81e1cf0] [0x80ecd38] [vt: 0xbfffddec] )

That looks like a bug in our classes, because the compiler on Windows
can cope with that.

The way we parse hex strings in the compiler is by calling this:

	ul = System.UInt64.Parse (s,NumberStyles.HexNumber);

My guess is that we have yet to implement Parse correctly in most of our
Int classes.  We have a small fast implementation for the common code
path, but we do not support the complete Parse specification.  

This needs to be looked into.

Miguel