[Mono-devel-list] possible bug in static constructor evaluation order

Michal Moskal malekith at pld-linux.org
Sun May 4 15:08:49 EDT 2003


Could anyone confirm this with current CVS (I cannot get it to run)?

The following code (under mono-0.23):

#v+
class A {
  static A() { System.Console.WriteLine("A"); }
  public static void f() {}
}
class B {
  static B() { System.Console.WriteLine("B"); A.f(); }
  public static void f() {}
}
class M {
  public static void Main() { B.f(); }
}
#v-

produces:
A
B

where it should produce (and it does under pnet):
B
A

(as per my spec reading 17.11 paragraph 6).

The bug only occurs when class is referenced from static constructor of
some other class.

-- 
: Michal Moskal :: http://www.kernel.pl/~malekith : GCS {C,UL}++++$ a? !tv
: PLD Linux ::::::::: Wroclaw University, CS Dept : {E-,w}-- {b++,e}>+++ h




More information about the Mono-devel-list mailing list