[Mono-bugs] [Bug 79238][Nor] New - Internal compiler error during overload resolution for generic functions

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Thu Aug 31 17:28:31 EDT 2006

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 dpotapov at gmail.com.


--- shadow/79238	2006-08-31 17:28:31.000000000 -0400
+++ shadow/79238.tmp.6970	2006-08-31 17:28:31.000000000 -0400
@@ -0,0 +1,87 @@
+Bug#: 79238
+Product: Mono: Compilers
+Version: 1.1
+OS: GNU/Linux [Other]
+OS Details: Debian sarge
+Status: NEW   
+Priority: Normal
+Component: C#
+AssignedTo: rharinath at novell.com                            
+ReportedBy: dpotapov at gmail.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+Summary: Internal compiler error during overload resolution for generic functions
+Description of Problem:
+Mono C# compiler (gmcs) reports an internal error when it tries to resolve
+what of two generic functions with the same name (but different signature)
+should be used.
+Steps to reproduce the problem:
+Try to compile the following code:
+=== test.cs ===
+public interface IFoo
+        void Foo<T>(ref T? v) where T:struct;
+        void Foo<T>(ref T v) where T:new();
+public struct Point
+        int x, y;
+        public Point(int x, int y) { this.x = x; this.y = y; }
+struct TestPoint
+        public static void Serialize(IFoo h)
+        {
+                Point? point = new Point(1,2);
+                h.Foo(ref point);
+        }
+        public static void Main(){}
+Actual Results:
+Exception caught by the compiler while compiling:
+   Block that caused the problem begin at: test.cs(15,21):
+                     Block being compiled: [test.cs(16,2):,test.cs(19,2):]
+System.IndexOutOfRangeException: Array index is out of range.
+Unhandled Exception: System.IndexOutOfRangeException: Array index is out of
+in <0x000f7> Mono.CSharp.Invocation:MoreSpecific (System.Type p, System.Type q)
+in <0x0039b> Mono.CSharp.Invocation:BetterFunction (Mono.CSharp.EmitContext
+ec, System.Collections.ArrayList args, Int32 argument_count,
+System.Reflection.MethodBase candidate, Boolean candidate_params,
+System.Reflection.MethodBase best, Boolean best_params, Location loc)
+in <0x009dc> Mono.CSharp.Invocation:OverloadResolve
+(Mono.CSharp.EmitContext ec, Mono.CSharp.MethodGroupExpr me,
+System.Collections.ArrayList Arguments, Boolean may_fail, Location loc)
+in <0x00322> Mono.CSharp.Invocation:DoResolve (Mono.CSharp.EmitContext ec)
+in <0x000e3> Mono.CSharp.Expression:Resolve (Mono.CSharp.EmitContext ec,
+ResolveFlags flags)
+in <0x00012> Mono.CSharp.Expression:Resolve (Mono.CSharp.EmitContext ec)
+in <0x00013> Mono.CSharp.ExpressionStatement:ResolveStatement
+(Mono.CSharp.EmitContext ec)
+in <0x0001f> Mono.CSharp.StatementExpression:Resolve
+(Mono.CSharp.EmitContext ec)
+in <0x001d9> Mono.CSharp.Block:Resolve (Mono.CSharp.EmitContext ec)
+in <0x00122> Mono.CSharp.EmitContext:ResolveTopBlock
+(Mono.CSharp.EmitContext anonymous_method_host, Mono.CSharp.ToplevelBlock
+block, Mono.CSharp.Parameters ip, IMethodData md, System.Boolean unreachable)
+Expected Results:
+The code should be compiled without any problems.
+How often does this happen? 
+Additional Information:
+I have used gmcs from Mono and Both have the same problem.

More information about the mono-bugs mailing list