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 [EMAIL PROTECTED] http://bugzilla.ximian.com/show_bug.cgi?id=79843 --- shadow/79843 2006-11-06 06:54:29.000000000 -0500 +++ shadow/79843.tmp.13973 2006-11-06 06:54:29.000000000 -0500 @@ -0,0 +1,68 @@ +Bug#: 79843 +Product: Mono: Compilers +Version: 1.1 +OS: GNU/Linux [Other] +OS Details: +Status: NEW +Resolution: +Severity: +Priority: Major +Component: C# +AssignedTo: [EMAIL PROTECTED] +ReportedBy: [EMAIL PROTECTED] +QAContact: [EMAIL PROTECTED] +TargetMilestone: --- +URL: +Cc: +Summary: Valid delegate assignation not regarded as valid + +Description of Problem: +When the method assigned to a delegate returns an interface type that is +convertible to the type-signature return of the delegate, the assignation +is rejected with the error CS0407. + +Steps to reproduce the problem: +1. Create test file "test.cs" as follows: + +delegate IInterface testDelegate(IInterface x); +interface IInterface { + int ID { get; } +} +class concrete : IInterface { + public int ID { get { return 0; } } +} +class Program { + private concrete getConcrete(IInterface z) { + return new concrete(); + } + public static void Main(string[] args) { + Program p = new Program(); + testDelegate x = new testDelegate(p.getConcrete); + // also fails on: + // testDelegate x = p.getConcrete; + // also fails on: + // testDelegate x = (testDelegate)p.getConcrete; + x(new concrete()); + } +} + +2. Try to compile test file. +3. Observe error. + +Actual Results: +Running "gmcs test.cs" results in the following output: +test.cs(18,24): error CS0407: `concrete Program.getConcrete(IInterface)' +has the wrong return type to match the delegate `IInterface +testDelegate(IInterface)' +Compilation failed: 1 error(s), 0 warnings + +Expected Results: +The compilation should succeed: delegates are supposed to allow covariance. + csc compiles the code just fine; unless there is a bug in that compiler, +the bug exists in gmcs. + +How often does this happen? +100% of the time. + +Additional Information: +Tested against version 1.1.18 on both Gentoo and Ubuntu. _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
