[Mono-bugs] [Bug 342584] New: Cast from IntPtr to Enum fails with CS0030

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sun Nov 18 09:05:25 EST 2007


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

           Summary: Cast from IntPtr to Enum fails with CS0030
           Product: Mono: Compilers
           Version: 1.2.6
          Platform: i386
        OS/Version: Ubuntu
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: C#
        AssignedTo: mono-bugs at ximian.com
        ReportedBy: stapostol at gmail.com
         QAContact: mono-bugs at ximian.com
          Found By: ---


The following code compiles on 1.2.4, 1.2.5 and csc.exe (2.0), but fails on
1.2.6 Preview 2 (mcs, gmcs).

using System;

namespace Test
{
    enum Key { A }

    class Regression
    {
        public static void Main()
        {
            IntPtr a = new IntPtr(1);
            Key k = (Key)a;
        }
    }
}

> gmcs enum_intptr.cs
enum_intptr.cs(12,22): error CS0030: Cannot convert type `System.IntPtr' to
`Test.Key'
Compilation failed: 1 error(s), 0 warnings


-- 
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