[Mono-bugs] [Bug 440774] New: `int*[]' array initializer problem

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri Oct 31 17:54:31 EDT 2008


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


           Summary: `int*[]' array initializer problem
           Product: Mono: Compilers
           Version: SVN
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: C#
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: martin at novell.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


When compiling the following test case:

======
using System;

namespace ConsoleApplication6
{
    unsafe class Program
    {
        static int a;
        static int* the_ptr = (int*) 0xdeadbeaf;
        static int** the_pptr = (int**) 0xdeadbeaf;

        static void Main(string[] args)
        {
            Console.WriteLine ("TEST: {0:x}", new IntPtr (the_pptr).ToInt64
());

            fixed (int* a_ptr = &a)
            {
                Console.WriteLine(new IntPtr(a_ptr));

                int*[] array = { the_ptr };
                int*[] array2 = { a_ptr };
                int* ptr = the_ptr;
                int** pptr = the_pptr;

                fixed (int** pptr2 = &the_ptr)
                {
                    Console.WriteLine(new IntPtr(pptr));
                }
            }
        }
    }
}
======

I'm getting

======
asgard at isengard:debugger$ mcs -unsafe -debug
/work/mordor/ConsoleApplication6/ConsoleApplication6/Program.cs 
/work/mordor/ConsoleApplication6/ConsoleApplication6/Program.cs(19,24): error
CS0029: Cannot implicitly convert type `int*' to `string'
/work/mordor/ConsoleApplication6/ConsoleApplication6/Program.cs(19,24): error
CS0029: Cannot implicitly convert type `string[]' to `int*[]'
/work/mordor/ConsoleApplication6/ConsoleApplication6/Program.cs(20,24): error
CS0622: Can only use array initializer expressions to assign to array types.
Try using a new expression instead
=======

This works fine with Visual Studio.


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