[Mono-bugs] [Bug 78965][Nor] New - Missing error CS1540

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Fri Jul 28 05:13:13 EDT 2006


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 contact at i-nz.net.

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

--- shadow/78965	2006-07-28 05:13:13.000000000 -0400
+++ shadow/78965.tmp.22456	2006-07-28 05:13:13.000000000 -0400
@@ -0,0 +1,81 @@
+Bug#: 78965
+Product: Mono: Compilers
+Version: 1.1
+OS: All
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: C#
+AssignedTo: rharinath at novell.com                            
+ReportedBy: contact at i-nz.net               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Missing error CS1540
+
+Description of Problem:
+The following test case should not compile.
+
+Steps to reproduce the problem:
+using System;
+ 
+namespace Test
+{
+    public class A
+    {
+        protected virtual int Property {
+            get { return 0; }
+        }
+    }
+ 
+    public class B : A
+    {
+        private sealed class C
+        {
+            public C (A a)
+            {
+                // A.Property is not accessible from here.
+                //
+                // Expected error:
+                //
+                // error CS1540: Cannot access protected member 
+'Test.A.Property' via a
+                // qualifier of type 'Test.A'; the qualifier must be of 
+type 'Test.B.C'
+                // (or derived from it)
+                //
+                int test = a.Property;
+                test++;
+            }
+        }
+ 
+        protected override int Property {
+            get { return 1; }
+        }
+    }
+ 
+    public class Tester
+    {
+        public static void Main (string[] args)
+        {            
+            Console.WriteLine ("I should not compile!");
+        }
+    } 
+}
+
+Actual Results:
+Compiles.
+
+Expected Results:
+error CS1540: Cannot access protected member 'Test.A.Property' via a 
+qualifier of type 'Test.A'; the qualifier must be of type 'Test.B.C' (or 
+derived from it)
+
+How often does this happen? 
+Always
+
+Additional Information:
+Tested with SVN HEAD.


More information about the mono-bugs mailing list