linux-packaging-mono/mcs/tests/gtest-fixedbuffer-05.cs
Jo Shields a575963da9 Imported Upstream version 3.6.0
Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
2014-08-13 10:39:27 +01:00

28 lines
341 B
C#

// Compiler options: -unsafe
unsafe struct S
{
public short nData;
public fixed int Data [1];
}
unsafe struct S2
{
public uint Header;
public fixed byte Data [5];
public void Test ()
{
fixed (byte* bP = Data) {
S* p = (S*) bP;
p = (S*) (p->Data + p->nData);
}
}
public static void Main ()
{
new S2 ().Test ();
}
}