[Mono-bugs] [Bug 610088] New: wrong result for overloaded virtual funcions in class hierarchy
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Fri May 28 19:26:05 EDT 2010
http://bugzilla.novell.com/show_bug.cgi?id=610088
http://bugzilla.novell.com/show_bug.cgi?id=610088#c0
Summary: wrong result for overloaded virtual funcions in class
hierarchy
Classification: Mono
Product: Mono: Compilers
Version: unspecified
Platform: Other
OS/Version: Other
Status: NEW
Severity: Critical
Priority: P5 - None
Component: C#
AssignedTo: mono-bugs at lists.ximian.com
ReportedBy: mreshadi at qualcomm.com
QAContact: mono-bugs at lists.ximian.com
Found By: ---
Blocker: ---
Description of Problem:
In a hierarchy, overloaded virtual functions that take types of same hierarchy
are not called correctly.
I tried this code with VisualStudio 2010, Monodevelope, mcs & gmcs (2.4.4 and
2.6.1). In call cases, the code generated by VS2010 runs correctly on both .NET
and mono runtime, and the code generatd by mono C# compiler is wrong on both
NET and mono runtime. So, definitly a compiler problem.
Steps to reproduce the problem:
1. Runn the folloing code.
2.
Actual Results:
-In A for Y
-In A for Y
-In A for X
In B for X
In C for Y
Expected Results:
-In A for Y
-In A for Y
-In A for Y
In C for Y
How often does this happen?
Always
Additional Information:
Code Sample:
using System;
namespace MonoVirtuals
{
class X { }
class Y : X { }
class A
{
public virtual void f(X o) { System.Console.WriteLine("-In A for X"); }
public virtual void f(Y o) { System.Console.WriteLine("-In A for Y"); }
}
class B : A
{
public override void f(X o) { base.f(o); System.Console.WriteLine("In B
for X"); }
}
class C : B
{
public override void f(X o) { base.f(o); System.Console.WriteLine("In C
for X"); }
public override void f(Y o) { base.f(o); System.Console.WriteLine("In C
for Y"); }
}
class MainClass
{
public static void Main(string[] args)
{
var o = new Y();
foreach (var c in new A[3] { new A(), new B(), new C() })
c.f(o);
}
}
}
--
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
More information about the mono-bugs
mailing list