Fix #75800
authorRaja R Harinath <harinath@hurrynot.org>
Thu, 20 Apr 2006 13:03:42 +0000 (13:03 -0000)
committerRaja R Harinath <harinath@hurrynot.org>
Thu, 20 Apr 2006 13:03:42 +0000 (13:03 -0000)
* mcs/expression.cs (Invocation.VerifyArgumentsCompat): Don't try
implicit conversions on 'out' and 'ref' arguments.
* gmcs/expression.cs: Likewise.
* errors/cs1502-7.cs: New test from #75800.

svn path=/trunk/mcs/; revision=59696

mcs/errors/ChangeLog
mcs/errors/cs1502-7.cs [new file with mode: 0644]
mcs/gmcs/ChangeLog
mcs/gmcs/expression.cs
mcs/mcs/ChangeLog
mcs/mcs/expression.cs

index 9daf5e3d0af0396c056a9382f345d1cce0b117f1..cf5e082efe7dc2ee66d888831b795deb35eac9cc 100644 (file)
@@ -1,5 +1,7 @@
 2006-04-20  Raja R Harinath  <rharinath@novell.com>
 
+       * cs1502-7.cs: New test from #75800.
+
        * cs0168-2.cs: New test from #66031.
 
 2006-04-18  Raja R Harinath  <rharinath@novell.com>
diff --git a/mcs/errors/cs1502-7.cs b/mcs/errors/cs1502-7.cs
new file mode 100644 (file)
index 0000000..e258068
--- /dev/null
@@ -0,0 +1,28 @@
+// cs1502-7.cs: The best overloaded method match for `TestCase.TestS(ref object)' has some invalid arguments
+// Line: 21
+
+using System;
+
+public struct Struct {
+       public int x, y, z;
+}
+
+public class TestCase {
+       
+       public static void Main() {
+               
+               Struct s = new Struct();
+               
+               s.x = 1;
+               s.y = 2;
+               
+               System.Console.WriteLine("{0} {1} {2}", s.x, s.y, s.z);
+               
+               TestS(ref s);
+       }       
+       
+       public static void TestS(ref object ino) {
+               System.Console.WriteLine("{0}", ((Struct)(ino)).x);
+       }
+       
+}
index 29d7d0e8fab88d505333d49469c126d88631825e..54c7670e3e2f2278019b4a07fa60299779c94225 100644 (file)
@@ -1,5 +1,9 @@
 2006-04-20  Raja R Harinath  <rharinath@novell.com>
 
+       Fix #75800
+       * expression.cs (Invocation.VerifyArgumentsCompat): Don't try
+       implicit conversions on 'out' and 'ref' arguments.
+
        * expression.cs (Invocation.VerifyArgumentsCompat): Reorganize to
        improve clarity.  Remove dead code.
 
index 964c72fa3fb0b0433a5622d482116a9c8b41fcaf..bad79b9acb97acb768007e0a6e8d5f61c8a55d90 100644 (file)
@@ -5088,6 +5088,9 @@ namespace Mono.CSharp {
                                        break;
 
                                if (!TypeManager.IsEqual (a.Type, parameter_type)) {
+                                       if (pm == Parameter.Modifier.OUT || pm == Parameter.Modifier.REF)
+                                               break;
+
                                        Expression conv = Convert.ImplicitConversion (ec, a_expr, parameter_type, loc);
                                        if (conv == null)
                                                break;
index 2328b9bcda0e4da2d7b4d7a74b35da950fd0fa98..d78270695fbdcc86c5062d55a35f58347281f78c 100644 (file)
@@ -1,5 +1,9 @@
 2006-04-20  Raja R Harinath  <rharinath@novell.com>
 
+       Fix #75800
+       * expression.cs (Invocation.VerifyArgumentsCompat): Don't try
+       implicit conversions on 'out' and 'ref' arguments.
+
        * expression.cs (Invocation.VerifyArgumentsCompat): Reorganize to
        improve clarity.  Remove dead code.
 
index e546a833f786985d60abde533fa10a0c9a7ff7c2..61e51f999275845d2a0e1c088f03dbe53e9f6e94 100644 (file)
@@ -4836,6 +4836,9 @@ namespace Mono.CSharp {
                                        break;
 
                                if (!a.Type.Equals (parameter_type)) {
+                                       if (pm == Parameter.Modifier.OUT || pm == Parameter.Modifier.REF)
+                                               break;
+
                                        Expression conv = Convert.ImplicitConversion (ec, a_expr, parameter_type, loc);
                                        if (conv == null)
                                                break;