[Mono-bugs] [Bug 355622] New: Compilation fails on unsafe array constructor.

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Jan 23 09:26:42 EST 2008


           Summary: Compilation fails on unsafe array constructor.
           Product: Mono: Compilers
           Version: 1.2.6
          Platform: All
        OS/Version: Linux
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: C#
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: stapostol at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---

The following code fails to compile on mcs/gmcs 1.2.6 (and previous):

$ cat bug.cs
class Bug
    unsafe int*[] data = new int*[16];

$ gmcs bug.cs /unsafe /target:library
unsafe2.cs(3,33): error CS0214: Pointers and fixed size buffers may only be
used in an unsafe context
Compilation failed: 1 error(s), 0 warnings

It compiles fine on csc.exe (tested on version 2.0).

This problem seems related to bug 324993
(https://bugzilla.novell.com/show_bug.cgi?id=MONO82324), since adding the
"unsafe" specifier to the class itself allows the code to compile:

unsafe class Bug
    int*[] data = new int*[16];

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