[Mono-bugs] [Bug 50820][Nor] New - mcs doesn't flag CS1540
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Sat, 7 Feb 2004 12:41:00 -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=50820
--- shadow/50820 2004-02-07 12:40:59.000000000 -0500
+++ shadow/50820.tmp.21441 2004-02-07 12:40:59.000000000 -0500
@@ -0,0 +1,64 @@
+Bug#: 50820
+Product: Mono/Compilers
+Version: unspecified
+OS: All
+OS Details:
+Status: NEW
+Resolution:
+Severity: Unknown
+Priority: Normal
+Component: C#
+AssignedTo: martin@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;
+ }
+}