[Mono-bugs] [Bug 65573][Wis] Changed - MCS doesn't report CS0133 for const int y = <non constant expr>

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Tue, 4 Jan 2005 14:03:49 -0500 (EST)


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 sebastien@ximian.com.

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

--- shadow/65573	2004-09-08 21:09:02.000000000 -0400
+++ shadow/65573.tmp.25250	2005-01-04 14:03:49.000000000 -0500
@@ -80,6 +80,31 @@
 	int x;
 	const int y = x;
 	static void Main () {}
 }
 
 This reports 150 but should report 133
+
+------- Additional Comments From sebastien@ximian.com  2005-01-04 14:03 -------
+The error is now reported correctly but MCS dies with a NFE just after.
+
+mcs bug65573.cs
+bug65573.cs(4) error CS0133: Arrays can not be constant
+ 
+Unhandled Exception: System.NullReferenceException: Object reference
+not set to an instance of an object
+in <0x00402> Mono.CSharp.Const:LookupConstantValue (object&)
+in <0x0001e> Mono.CSharp.Const:Emit ()
+in <0x00093> Mono.CSharp.TypeContainer:EmitConstants ()
+in <0x00485> Mono.CSharp.TypeContainer:EmitType ()
+in <0x003c4> Mono.CSharp.RootContext:EmitCode ()
+in <0x00bdd> Mono.CSharp.Driver:MainDriver (string[])
+in <0x0000f> Mono.CSharp.Driver:Main (string[])
+
+
+The second sample (by BenM) now reports CS0120
+
+mcs bug65573b.cs
+bug65573b.cs(3) error CS0120: An object reference is required for the
+non-static field `x'
+Compilation failed: 1 error(s), 0 warnings
+