[Mono-bugs] [Bug 75283][Min] New - instance variable with same name
as class sometimes treated as static
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Thu Jun 16 10:52:51 EDT 2005
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by danw at novell.com.
http://bugzilla.ximian.com/show_bug.cgi?id=75283
--- shadow/75283 2005-06-16 10:52:51.000000000 -0400
+++ shadow/75283.tmp.31834 2005-06-16 10:52:51.000000000 -0400
@@ -0,0 +1,40 @@
+Bug#: 75283
+Product: Mono: Compilers
+Version: 1.1
+OS:
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Minor
+Component: C#
+AssignedTo: mono-bugs at ximian.com
+ReportedBy: danw at novell.com
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: instance variable with same name as class sometimes treated as static
+
+The following program:
+
+ using System.Collections;
+
+ public class Test {
+
+ ArrayList ArrayList;
+
+ public static void Main () {
+ ArrayList.Capacity = 5;
+ }
+ }
+
+compiles fine (with mcs, not csc), but gives an error when run:
+
+ ** ERROR **: Invalid IL code at IL0000 in Test:Main (): IL_0000:
+ldfld 0x04000001
+
+This only happens if the field has the same name as the base name
+of its type, and if you're "using" the type's namespace. Otherwise
+it correctly tells you "An object reference is required for the
+non-static field ..."
More information about the mono-bugs
mailing list