[Mono-bugs] [Bug 50820][Wis] New - mcs doesn't flag CS1540

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Tue, 11 Nov 2003 11:38:45 -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 gonzalo@ximian.com.

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

--- shadow/50820	2003-11-11 11:38:45.000000000 -0500
+++ shadow/50820.tmp.12801	2003-11-11 11:38:45.000000000 -0500
@@ -0,0 +1,64 @@
+Bug#: 50820
+Product: Mono/MCS
+Version: unspecified
+OS: All
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: Misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: gonzalo@ximian.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: mcs doesn't flag CS1540
+
+Compile to a dll:
+----
+class A
+{
+        protected virtual void X ()
+        {
+        }
+}
+ 
+class B : A
+{
+}
+ 
+class C : A
+{
+        static B b = new B ();
+ 
+        static void M ()
+        {
+                b.X ();
+        }
+}
+-----
+Actual results:
+Compilation succedeed
+
+Expected results:
+bug.cs(xx) error CS1540: Cannot access protected member `A.X()' via a
+qualifier of type `B'; the qualifier must be of type `C' (or derived from it)
+
+Additional information:
+mcs displays the error in this case:
+
+class A
+{
+        protected int n;
+}
+
+class B : A
+{
+        public static void Main ()
+	{
+		A b = new A ();
+		b.n = 1;
+	}
+}