[Mono-list] small compiler problem

Ian MacLean ianm@ActiveState.com
Wed, 16 Oct 2002 10:58:36 -0700


the following code compiles fine with csc on but fails with mcs.

class foo {

     public delegate void BuildEventHandler(object sender, object e);
     public static event BuildEventHandler BuildStarted;

     static void static1()
     {
         if (BuildStarted != null) {
             BuildStarted( null, null );
         }
     }

     static void Main(string[] args){

     }
}

with mcs I get the following compile error:

staticbug.cs(9) error CS0120: An object reference is required for the 
non-static field `BuildStarted'
Compilation failed: 1 error(s), 0 warnings

It mistakenly thinks that BuildStarted is non static.

This is with the latest mcs in cvs.

Ian