[Mono-bugs] [Bug 523683] New: GMCS fails to perform overload resolution for delegates with generic arguments in certain cases

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon Jul 20 19:22:55 EDT 2009


http://bugzilla.novell.com/show_bug.cgi?id=523683


           Summary: GMCS fails to perform overload resolution for
                    delegates with generic arguments in certain cases
    Classification: Mono
           Product: Mono: Compilers
           Version: SVN
          Platform: Macintosh
        OS/Version: Mac OS X 10.5
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: C#
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: tom.philpot at logos.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


User-Agent:       Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US;
rv:1.9.1.1) Gecko/20090715 Firefox/3.5.1

We found the following bug with gmcs ( r138189).

using System;
using System.Linq;
using System.Collections.Generic;
using System.Collections.ObjectModel;

namespace TestNS
{
    public class TestCase
    {
        public static int Compare<T>(T[] array1, T[] array2)
        {
            return 0;
        }

        public static void DoSomething<T>(Func<T, T, int> fn)
        {
            Console.WriteLine(fn(default(T), default(T)));
        }

        public static void DoSomethingElse()
        {
            // Does not work
            DoSomething<byte[]>(TestCase.Compare);
            // Does work
            // DoSomething<byte[]>((a, b) => TestCase.Compare(a, b));
        }
    }
}


[ tom.philpot]$ gmcs TestCompiler.cs -out:TestCompiler.dll
Internal compiler error at TestCompiler.cs(23,36):: exception caught while
emitting MethodBuilder [TestCase::DoSomethingElse]

Unhandled Exception: Mono.CSharp.InternalErrorException: VerifyArgumentsCompat
didn't find any problem with rejected candidate Void
DoSomething[Byte[]](System.Func`3[System.Byte[],System.Byte[],System.Int32])
  at Mono.CSharp.MethodGroupExpr.OverloadResolve (Mono.CSharp.EmitContext ec,
Mono.CSharp.Arguments& Arguments, Boolean may_fail, Location loc) [0x00000] 

Reproducible: Always

Steps to Reproduce:
1. Compile the above code
2. ????
3. Profit!
Actual Results:  
ws1048:LDLS4.Macintosh tom.philpot$ gmcs TestCompiler.cs -out:TestCompiler.dll
Internal compiler error at TestCompiler.cs(23,36):: exception caught while
emitting MethodBuilder [TestCase::DoSomethingElse]

Unhandled Exception: Mono.CSharp.InternalErrorException: VerifyArgumentsCompat
didn't find any problem with rejected candidate Void
DoSomething[Byte[]](System.Func`3[System.Byte[],System.Byte[],System.Int32])
  at Mono.CSharp.MethodGroupExpr.OverloadResolve (Mono.CSharp.EmitContext ec,
Mono.CSharp.Arguments& Arguments, Boolean may_fail, Location loc) [0x00000] 
  at Mono.CSharp.Invocation.DoResolveOverload (Mono.CSharp.EmitContext ec)
[0x00000] 
  at Mono.CSharp.Invocation.DoResolve (Mono.CSharp.EmitContext ec) [0x00000] 
  at Mono.CSharp.Expression.Resolve (Mono.CSharp.EmitContext ec, ResolveFlags
flags) [0x00000] 
  at Mono.CSharp.Expression.Resolve (Mono.CSharp.EmitContext ec) [0x00000] 
  at Mono.CSharp.ExpressionStatement.ResolveStatement (Mono.CSharp.EmitContext
ec) [0x00000] 
  at Mono.CSharp.StatementExpression.Resolve (Mono.CSharp.EmitContext ec)
[0x00000] 
  at Mono.CSharp.Block.Resolve (Mono.CSharp.EmitContext ec) [0x00000] 
  at Mono.CSharp.EmitContext.ResolveTopBlock (Mono.CSharp.EmitContext
anonymous_method_host, Mono.CSharp.ToplevelBlock block,
Mono.CSharp.ParametersCompiled ip, IMethodData md, System.Boolean& unreachable)
[0x00000] 
  at Mono.CSharp.EmitContext.EmitTopBlock (IMethodData md,
Mono.CSharp.ToplevelBlock block) [0x00000] 
  at Mono.CSharp.MethodData.Emit (Mono.CSharp.DeclSpace parent) [0x00000] 
  at Mono.CSharp.MethodOrOperator.Emit () [0x00000] 
  at Mono.CSharp.Method.Emit () [0x00000] 


Expected Results:  
No compiler errors and an emitted assembly.

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list