[Mono-bugs] [Bug 71257][Nor] New - Should report instance-access to constants as errors

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Thu, 13 Jan 2005 21:03:52 -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 miguel@ximian.com.

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

--- shadow/71257	2005-01-13 21:03:52.000000000 -0500
+++ shadow/71257.tmp.31861	2005-01-13 21:03:52.000000000 -0500
@@ -0,0 +1,40 @@
+Bug#: 71257
+Product: Mono: Compilers
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: C#
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: miguel@ximian.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Should report instance-access to constants as errors
+
+The following sample should produce a CS176 `static member X.CONST' cannot
+be acccessed with an instance:
+
+public class X {
+	public const double CONST = 1;
+}
+
+internal class Y : X {
+
+	int D (X x)
+	{
+		X x = new X ();
+		double d = x.CONST;
+		return 1;
+	}
+	
+	static void Main ()
+	{
+	}
+}
+
+Currently we compile it.