[Mono-bugs] [Bug 52492][Wis] New - We do not detect CS0034 in the presence of implicit conversions

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Tue, 23 Dec 2003 13:20:19 -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=52492

--- shadow/52492	2003-12-23 13:20:18.000000000 -0500
+++ shadow/52492.tmp.3591	2003-12-23 13:20:19.000000000 -0500
@@ -0,0 +1,42 @@
+Bug#: 52492
+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: We do not detect CS0034 in the presence of implicit conversions
+
+MCS incorrectly compiles this code:
+
+public class A {
+	public static implicit operator int (A a)
+	{
+		return 0;
+	}
+
+	public static implicit operator string (A a)
+	{
+		return null;
+	}
+
+	public static void Main ()
+	{
+		A a = new A ();
+		object o = a + a;
+	}
+}
+
+csc gives
+
+t.cs(15,14): error CS0034: Operator '+' is ambiguous on operands of 
+type 'A' and 'A'