[Mono-bugs] [Bug 60603][Nor] New - mcs does not see conversion operators in superclass

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Wed, 23 Jun 2004 01:43:43 -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 mathpup@mylinuxisp.com.

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

--- shadow/60603	2004-06-23 01:43:43.000000000 -0400
+++ shadow/60603.tmp.5125	2004-06-23 01:43:43.000000000 -0400
@@ -0,0 +1,76 @@
+Bug#: 60603
+Product: Mono: Compilers
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: C#
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: mathpup@mylinuxisp.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: mcs does not see conversion operators in superclass
+
+Description of Problem: 
+ 
+The problem is illustrated in the program below. When a base class Base 
+defines a conversion operator from one type to Base, and a derived class 
+Derived defines a conversion operator from a different type to Derived, 
+the derived class operator hides the base class operator. If the Derived 
+class's conversion operator is removed, the problem disappears. 
+ 
+using System; 
+ 
+public class Base 
+{ 
+	public static implicit operator Base(IntPtr p) 
+	{ 
+		return null; 
+	} 
+} 
+ 
+public class Derived: Base 
+{ 
+	public static implicit operator Derived(string s) 
+	{ 
+		return new Derived(); 
+	} 
+} 
+ 
+public class Testing 
+{ 
+	public static void Main() 
+	{ 
+		Base m = (Derived) IntPtr.Zero; 
+	} 
+} 
+ 
+ 
+Steps to reproduce the problem: 
+1. mcs implicit.cs 
+ 
+ 
+Actual Results: 
+ 
+implicit.cs(28) error CS0030: Cannot convert type 'System.IntPtr' to 
+'Derived' 
+ 
+ 
+Expected Results: 
+ 
+Successful compilation 
+ 
+ 
+How often does this happen?  
+ 
+Always 
+ 
+ 
+Additional Information: 
+ 
+The code above compiles with csc.