[Mono-bugs] [Bug 79362][Blo] New - [GMCS] Cannot access protected members of base class from the constructor

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Mon Sep 11 15:28:05 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 jan.oravec at 6com.sk.

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

--- shadow/79362	2006-09-11 15:28:05.000000000 -0400
+++ shadow/79362.tmp.32487	2006-09-11 15:28:05.000000000 -0400
@@ -0,0 +1,54 @@
+Bug#: 79362
+Product: Mono: Compilers
+Version: 1.1
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Blocker
+Component: C#
+AssignedTo: rharinath at novell.com                            
+ReportedBy: jan.oravec at 6com.sk               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: [GMCS] Cannot access protected members of base class from the constructor
+
+Compilation of the following code:
+
+class A<T>
+{
+  protected A ()
+  {
+  }
+
+  protected int Foo
+  {
+    get
+    {
+      return 47;
+    }
+  }
+}
+
+
+class B<T> : A<T>
+{
+  public B () : base ()
+  {
+    System.Console.WriteLine (this.Foo);
+  }
+}
+
+
+Fails with:
+
+b.cs(21,31): error CS1540: Cannot access protected member `A<T>.Foo' via a
+qualifier of type `B<T>'; the qualifier must be of type `B<T>' (or derived
+from it)
+
+The error message is obviously non-sense. Similar non-generic code is
+compilable. Also, changing 'protected int Foo' to 'public int Foo' helps to
+compile the code.


More information about the mono-bugs mailing list