[Mono-list] bug in mcs

Martin Adoue martin@cwanet.com
Tue, 16 Apr 2002 02:20:16 -0300


test.cs, attached below, compiles cleanly with csc (csc /target:library
test.cs)
but fails with mcs (mcs --target library -r System  test.cs)

.\test.cs(11) error CS0118: Expression denotes a `value' where a `variable'
was expected
.\test.cs(3) error CS0161: Not all code paths return a value
Error: Compilation failed

using System;
public class ClassTest{
public static char GetChar(string Str, int Index)
  {
   if (Str == null)
    throw new ArgumentException("Length of argument 'String' must be greater
than zero.", "String");
   if (Index < 1)
    throw new ArgumentException("Argument 'Index' must be greater than or
equal to 1.", "Index");
   if (Index > Str.Length)
    throw new ArgumentException("Argument 'Index' must be less than or equal
to the length of 'String'.", "Index");
   return Str.ToCharArray(Index -1, 1)[0];
  }
}