[Mono-bugs] [Bug 35607][Nor] New - Mono falls over with some bogus code.

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
14 Dec 2002 01:10:02 -0000


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 jmallett@freebsd.org.

http://bugzilla.ximian.com/show_bug.cgi?id=35607

--- shadow/35607	Fri Dec 13 20:10:02 2002
+++ shadow/35607.tmp.3722	Fri Dec 13 20:10:02 2002
@@ -0,0 +1,88 @@
+Bug#: 35607
+Product: Mono/MCS
+Version: unspecified
+OS: other
+OS Details: FreeBSD 5.0
+Status: NEW   
+Resolution: 
+Severity: Unknown
+Priority: Normal
+Component: Misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: jmallett@FreeBSD.org               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Mono falls over with some bogus code.
+
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+MCS catches an exception with certain forms of bogus code.
+
+Steps to reproduce the problem:
+1. Try to compile the program in the additional info.
+
+Actual Results:
+Exception caught by the compiler while compiling:
+   Block that caused the problem begin at: test.cs: (13)
+                     Block being compiled: [test.cs: (14),test.cs: (16)]
+
+Unhandled Exception: System.Exception: non-static FieldExpr without
+instance varYou have to assign the Instance variable
+Of the FieldExpr to set this
+
+in <0x00066> 00 Mono.CSharp.FieldExpr:DoResolve (Mono.CSharp.EmitContext)
+in <0x0008d> 00 Mono.CSharp.FieldExpr:DoResolveLValue
+(Mono.CSharp.EmitContext,Mono.CSharp.Expression)
+in <0x004a1> 00 Mono.CSharp.MemberAccess:DoResolve
+(Mono.CSharp.EmitContext,Mono.CSharp.Expression,Mono.CSharp.ResolveFlags)
+in <0x0001d> 00 Mono.CSharp.MemberAccess:DoResolveLValue
+(Mono.CSharp.EmitContext,Mono.CSharp.Expression)
+in <0x0002a> 00 Mono.CSharp.Expression:ResolveLValue
+(Mono.CSharp.EmitContext,Mono.CSharp.Expression)
+in <0x00298> 00 Mono.CSharp.Assign:DoResolve (Mono.CSharp.EmitContext)
+in <0x0014a> 00 Mono.CSharp.Expression:Resolve
+(Mono.CSharp.EmitContext,Mono.CSharp.ResolveFlags)
+in <0x0001d> 00 Mono.CSharp.StatementExpression:Resolve
+(Mono.CSharp.EmitContext)
+in <0x00257> 00 Mono.CSharp.Block:Resolve (Mono.CSharp.EmitContext)
+in <0x00104> 00 Mono.CSharp.EmitContext:EmitTopBlock
+(Mono.CSharp.Block,Mono.CSharp.InternalParameters,Mono.CSharp.Location)
+in <0x00342> 00 Mono.CSharp.EmitContext:EmitTopBlock
+(Mono.CSharp.Block,Mono.CSharp.InternalParameters,Mono.CSharp.Location)
+in <0x005c2> 00 Mono.CSharp.MethodData:Emit
+(Mono.CSharp.TypeContainer,Mono.CSharp.Block,object)
+in <0x00023> 00 Mono.CSharp.Method:Emit (Mono.CSharp.TypeContainer)
+in <0x00291> 00 Mono.CSharp.TypeContainer:Emit ()
+in <0x004de> 00 Mono.CSharp.RootContext:EmitCode ()
+in <0x00718> 00 Mono.CSharp.Driver:MainDriver (string[])
+in <0x0000f> 00 Mono.CSharp.Driver:Main (string[])
+
+Expected Results:
+test.cs(15) error CS0120: An object reference is required for the
+non-static field `Y'
+Compilation failed: 1 error(s), 0 warnings
+
+How often does this happen? 
+Every time.
+
+Additional Information:
+using System;
+
+class X {
+	// Public properties and variables.
+	public string Y;
+
+	// Constructors.
+	public X()
+	{
+	}
+
+	// Public static methods.
+	public static void Main(string[] Arguments)
+	{
+		X.Y = "";
+	}
+}