[Mono-bugs] [Bug 79082][Nor] New - Implicit conversion to decimal with unary minus

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Tue Aug 15 18:27:23 EDT 2006


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 kwolfli at yahoo.de.

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

--- shadow/79082	2006-08-15 18:27:23.000000000 -0400
+++ shadow/79082.tmp.4461	2006-08-15 18:27:23.000000000 -0400
@@ -0,0 +1,35 @@
+Bug#: 79082
+Product: Mono: Compilers
+Version: 1.1
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: C#
+AssignedTo: rharinath at novell.com                            
+ReportedBy: kwolfli at yahoo.de               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Implicit conversion to decimal with unary minus
+
+While my previosly reported bug #79070 (Implicit conversion to decimal on
+both operands) is fixed in 1.1.16.1, the following code still doesn't work
+for me (it works with csc). The error message is "unary.cs(8,30): error
+CS0023: Operator `-' cannot be applied to operand of type `MyDecimal'".
+Again, mcs will compile successfully when using int instead of decimal.
+
+
+class MyDecimal {
+  public static implicit operator decimal(MyDecimal d) { return 42; }
+}
+
+class Unary {
+  public static void Main() {
+    MyDecimal d = new MyDecimal();
+    System.Console.WriteLine(-d);
+  }
+}


More information about the mono-bugs mailing list