[Mono-bugs] [Bug 659038] New: Internal compiler error: Cannot cast from source type to destination type

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sun Dec 12 19:03:35 EST 2010


https://bugzilla.novell.com/show_bug.cgi?id=659038

https://bugzilla.novell.com/show_bug.cgi?id=659038#c0


           Summary: Internal compiler error: Cannot cast from source type
                    to destination type
    Classification: Mono
           Product: Mono: Runtime
           Version: 2.8.x
          Platform: Other
               URL: http://pastebin.com/raw.php?i=mXDQDvYX
        OS/Version: Mac OS X 10.3
            Status: NEW
          Severity: Major
          Priority: P5 - None
         Component: generics
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: don at env.com.ua
         QAContact: mono-bugs at lists.ximian.com
          Found By: Development
           Blocker: ---


Description of Problem:

The code compiles well under .NET 3.5 but fails to compile under Mono 2.8 (OSX
running in VirtualBox). There is something wrong with resolving of correct
this[...] property in base interfaces.

To reproduce the problem compile the code below:

using System.Collections;
using System.Collections.Generic;

namespace MonoBug
{
    public interface IArray : IList
    {
        object this[params int[] index] { get; set; }
    }

    public interface IArray<T> : IArray, IList<T>
    {
        new T this[params int[] index] { get; set; }
    }

    public class Class1<T> : List<T>, IArray<T>
    {
        IArray<T> Source { get { return null; } }

        /// <summary>
        /// BUG: compiles on Windows but generates error under Mono (OSX)
        /// 
        /// error CS0584: Internal compiler error: Cannot cast from source type
to destination type.
        /// error CS0266: Cannot implicitly convert type `object' to `T'. An
explicit conversion exists (are you missing a cast?)
        /// </summary>
        /// <param name="index"></param>
        /// <returns></returns>
        T IList<T>.this[int index]
        {
            get { return Source[index]; } 
            set { Source[index] = value; }
        }

        object IArray.this[params int[] index] { get { return null; } set { } }

        public T this[params int[] index] { get { return default(T); } set { }
}
    }
}

-- 
Configure bugmail: https://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