[Mono-bugs] [Bug 55786][Wis] New - `override' members should not be included in member lookup

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Thu, 18 Mar 2004 20:51:22 -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 bmaurer@users.sf.net.

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

--- shadow/55786	2004-03-18 20:51:22.000000000 -0500
+++ shadow/55786.tmp.638	2004-03-18 20:51:22.000000000 -0500
@@ -0,0 +1,41 @@
+Bug#: 55786
+Product: Mono: Compilers
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: C#
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: bmaurer@users.sf.net               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: `override' members should not be included in member lookup
+
+The following code:
+class A {
+	public virtual int Foo () { return 1; }
+}
+class B : A {
+	new int Foo () { return 2; }
+	static void Main () { System.Console.WriteLine (new C ().Foo ()); }
+}
+class C : B {
+	public override int Foo () { return 1; }
+}
+
+prints `2' when compiled with csc, but `1' when compiled with mcs.
+
+§14.3 of the spec states that:
+
+A member lookup of a name N in a type T is processed as follows:
+
+First, the set of all accessible (§10.5) members named N declared in T and
+the base types (§14.3.1) of T is constructed. Declarations that include an
+override modifier are excluded from the set.
+
+We do not follow the last statement.