[Mono-bugs] [Bug 30443][Nor] New - Missing implicit conversion on user defined operators

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
17 Sep 2002 01:31:22 -0000


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 miguel@ximian.com.

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

--- shadow/30443	Mon Sep 16 21:31:22 2002
+++ shadow/30443.tmp.21825	Mon Sep 16 21:31:22 2002
@@ -0,0 +1,56 @@
+Bug#: 30443
+Product: Mono/MCS
+Version: unspecified
+OS: other
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: Misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: miguel@ximian.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Missing implicit conversion on user defined operators
+
+I ran into this while trying to get Mono.PEToolkit to work with MCS, I
+include a sample program that should do an implicit int conversion and do a
+compare not with the object's data but with the implicit conversion data.
+
+Currently this fails to compile.
+
+using System;
+
+struct RVA {
+	public uint value;
+
+	public RVA (uint val)
+	{
+		value = val;
+	}
+
+	public static implicit operator RVA (uint val)
+	{
+		return new RVA (val);
+	}
+
+	public static implicit operator uint (RVA rva)
+	{
+		return rva.value;
+	}
+
+}
+
+class X {
+	static void Main ()
+	{
+		RVA a = 10;
+		RVA b = 20;
+
+		if (a <= b)
+			return;
+	}
+}