[Mono-bugs] [Bug 46088][Nor] New - Nested class can access private members of base class of enclosing class

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
Thu, 10 Jul 2003 10:38:34 -0400 (EDT)


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 sestoft@dina.kvl.dk.

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

--- shadow/46088	Thu Jul 10 10:38:34 2003
+++ shadow/46088.tmp.1852	Thu Jul 10 10:38:34 2003
@@ -0,0 +1,61 @@
+Bug#: 46088
+Product: Mono/MCS
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: Misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: sestoft@dina.kvl.dk               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Nested class can access private members of base class of enclosing class
+
+Description of Problem:
+
+A nested class can access private members of base class of the enclosing
+class; it should not be permitted to.
+
+Steps to reproduce the problem:
+1. Compile this program: 
+
+using System;
+
+class B { 
+  private static int bz = 10;
+}
+
+class C : B {
+  public class D {
+    public static int dz = bz + 2;
+  }
+}
+
+class MyTest {
+  public static void Main(String[] args) {
+    Console.WriteLine(C.D.dz);
+  }
+}
+
+
+Actual Results:
+
+Mono mcs 0.23 compiles it without warnings or errors.
+
+Expected Results:
+
+The compiler should reject the access bz inside class C.D.
+
+
+How often does this happen? 
+
+Always.
+
+Additional Information:
+
+MS csc 1.1 rejects this access.