[Mono-bugs] [Bug 41457][Blo] New - mcs compilation fail when we use overloaded function with out param from another assembly - sample inside the description

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
Wed, 16 Apr 2003 13:26:28 -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 gfr@skynet.be.

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

--- shadow/41457	Wed Apr 16 13:26:28 2003
+++ shadow/41457.tmp.9186	Wed Apr 16 13:26:28 2003
@@ -0,0 +1,163 @@
+Bug#: 41457
+Product: Mono/MCS
+Version: unspecified
+OS: Red Hat 8.0
+OS Details: Red Hat 8 & 9 - mono 0.23 - libgc-6.1-1
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Blocker
+Component: Misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: gfr@skynet.be               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Summary: mcs compilation fail when we use overloaded function with out param from another assembly - sample inside the description
+
+Description of Problem:
+
+The mcs compilation fail when you try
+to use an overloaded function from another
+assembly when one parameter is always with
+an out params. 
+
+The same code work if it's compiled inside the 
+same assembly.
+
+The error occurs with the following configuration
+
+  Red Hat 8
+  Mono 0.23
+  libgc-6.1-1
+
+  uname -a give Linux XXXX 2.4.18-19.8.0 #1 Thu Dec 12 05:39:29 EST 2002 
+i686 i686 i386 GNU/Linux
+
+I Have the same problem with
+
+  Red Hat 9
+  Mono 0.23
+  libgc-6.1-1
+
+  ALL package up2date with RHN-Applet at the 04/16/2003
+ 
+Steps to reproduce the problem:
+
+1. Create the file called 'File1.cs' with the
+   following content:
+
+>>> SOT >>>
+using System;
+using System.IO;
+
+namespace Module1
+{
+  public class Class1
+  {
+    public static System.Boolean fn (System.String str1, out 
+System.Object obj)
+    {
+       obj = null;
+
+       return false;
+    }
+
+    public static System.Boolean fn (Stream stream, out System.Object obj)
+    {
+       obj = null;
+
+       return false;
+    }
+  }
+}
+>>> EOT >>>
+ 
+2. Create the file called 'File2.cs' with the
+   following content:
+
+>>> SOT >>>
+using System;
+using System.IO;
+
+using Module1;
+
+namespace Module2
+{ 
+  public class Class2
+  { 
+    public static System.Boolean fn (System.String str1, out 
+System.Object obj)
+    {
+       return Class1.fn (str1, out obj);
+    }
+
+    public static System.Boolean fn (Stream stream, out System.Object obj)
+    {
+       return Class1.fn (stream, out obj);
+    }
+  }    
+}   
+>>> EOT >>>
+
+3. Create the file build.sh with the following content
+
+>>> SOT >>>
+#!/bin/bash
+echo compiling Modulex with file File1.cs
+mcs -target:library -out:Modulex.dll File1.cs File2.cs
+echo ""
+echo compiling Module1 with file File1.cs
+mcs -target:library -out:Module1.dll File1.cs
+echo ""
+echo compiling Module2 with file File2.cs
+mcs -target:library -out:Module2.dll -r:Module1.dll File2.cs
+echo ""
+>>> EOT >>>
+
+4. run the command : sh ./build.sh
+
+Actual Results:
+
+>>> SOT >>>
+compiling Modulex with file File1.cs
+Compilation succeeded
+
+compiling Module1 with file File1.cs
+Compilation succeeded
+
+compiling Module2 with file File2.cs
+File2.cs(17) error CS1502: The best overloaded match for method 'bool 
+Module1.Class1.fn (System.IO.Stream, object)' has some invalid arguments
+File2.cs(17) error CS1503: Argument 1: Cannot convert from 'out object' 
+to 'object'
+File2.cs(17) error CS-0006: Could not find any applicable function for 
+this argument list
+Compilation failed: 3 error(s), 0 warnings
+>>> EOT >>>
+
+Expected Results:
+
+>>> SOT >>>
+compiling Modulex with file File1.cs
+Compilation succeeded
+
+compiling Module1 with file File1.cs
+Compilation succeeded
+
+compiling Module2 with file File2.cs
+Compilation succeeded
+>>> EOT >>>
+
+
+How often does this happen? 
+
+  Each Time
+
+Additional Information:
+
+  It's doesn't happens when the source are put
+  in the same assembly.   Moreover, if you remove 
+  the out keywork everywhere => that's works
+
+  Good luck to find this bug