[Mono-bugs] [Bug 56774][Nor] New - implicit type conversion behaviour differs from csc

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Sat, 10 Apr 2004 01:43:56 -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 vladimir@pobox.com.

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

--- shadow/56774	2004-04-10 01:43:56.000000000 -0400
+++ shadow/56774.tmp.24085	2004-04-10 01:43:56.000000000 -0400
@@ -0,0 +1,51 @@
+Bug#: 56774
+Product: Mono: Compilers
+Version: unspecified
+OS: Red Hat 9.0
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: C#
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: vladimir@pobox.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: implicit type conversion behaviour differs from csc
+
+The code here compiles without issue and prints "byte" with .NET 1.1;
+compiling with mcs gives:
+
+bug25.cs(21) error CS0121: Ambiguous call when selecting function due to
+implicit casts
+bug25.cs(21) error CS1501: New invocation: Can not find a constructor in
+`MyClass' for this argument list
+
+Unless there's something in the spec specifically about this case, I'd
+almost think this is a csc bug; unfortunately, the
+System.Drawing.Imaging.EncoderParameter class has exactly this kind of set
+of constructors, and there's a common usage of "new EncoderParameter
+(Encoder.Quality, 80);" (e.g. ngallery) which doesn't compile with mcs.
+
+--- bug25.cs ---
+using System;
+public sealed class MyClass {
+  public MyClass (byte value)
+  { Console.WriteLine ("byte"); }
+
+  public MyClass (short value)
+  { Console.WriteLine ("short"); }
+
+  public MyClass (long value)
+  { Console.WriteLine ("long"); }
+}
+
+class TestClass {
+  public static void Main () {
+    MyClass mc = new MyClass(5);
+  }
+}
+---- end ----