[Mono-dev] Gmcs compiler bug with generics

Tom Philpot tom.philpot at logos.com
Mon Jul 20 19:24:55 EDT 2009


This is filed under Bug #523683.

On 7/20/09 4:08 PM, "Tom Philpot" <tom.philpot at logos.com> wrote:

> We found the following bug with gmcs ( r138189). I¹ll be filling a bugzilla
> report as well, but thought I¹d post it here in case someone wants a head
> start.
> 
> Tom
> 
> 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] 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20090720/9cf06dc3/attachment.html 


More information about the Mono-devel-list mailing list