[Mono-bugs] [Bug 575611] New: sizeof operator doesn't work

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sun Jan 31 17:02:56 EST 2010


http://bugzilla.novell.com/show_bug.cgi?id=575611

http://bugzilla.novell.com/show_bug.cgi?id=575611#c0


           Summary: sizeof operator doesn't work
    Classification: Mono
           Product: Mono: Compilers
           Version: 2.6.x
          Platform: Other
        OS/Version: openSUSE 11.0
            Status: NEW
          Severity: Major
          Priority: P5 - None
         Component: C#
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: post-christian at freenet.de
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


Description of Problem:

The sizeof operator in the code below doesn't work with the mono compiler.
Since it works with the Microsoft .Net compiler if think it is a bug.

Steps to reproduce the problem:

compile the following code...

using System;
using System.Runtime.InteropServices;

class UnsafeTest
{
    [StructLayout( LayoutKind.Sequential )]
    public unsafe struct Foo
    {
        public Bar* bar;
    }

    [StructLayout( LayoutKind.Sequential )]
    public struct Bar
    {
        public Foo foo;
    }

    public unsafe static void Main( string[] arg ) {
        Console.WriteLine( sizeof( Foo ) );
    }
}


Actual Results:

unsafe.cs(19,36): error CS0208: Cannot take the address of, get the size of, or
declare a pointer to a managed type `UnsafeTest.Foo'
unsafe.cs(7,30): (Location of the symbol related to previous error)
Compilation failed: 1 error(s), 0 warnings

Expected Results:

no errors

How often does this happen? 

every time

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