Skip to content

Commit 86d72be

Browse files
committed
ignore size for auto layout
1 parent 1ed8448 commit 86d72be

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/tests/Loader/classloader/InlineArray/InlineArrayInvalid.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ public static void Explicit_Fails()
2626
public static void ExplicitSize_Fails()
2727
{
2828
Console.WriteLine($"{nameof(ExplicitSize_Fails)}...");
29+
30+
// .size is ignored for auto layout
31+
Assert.Equal(true, sizeof(ExplicitSizeAuto) > 0);
32+
2933
Assert.Throws<TypeLoadException>(() => { var t = typeof(ExplicitSize); });
3034

3135
Assert.Throws<TypeLoadException>(() =>

src/tests/Loader/classloader/InlineArray/InvalidCSharpInlineArray.il

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,17 @@
2525
.field [0] public valuetype [System.Runtime]System.Guid Guid
2626
}
2727

28+
.class public auto ansi sealed beforefieldinit ExplicitSizeAuto
29+
extends [System.Runtime]System.ValueType
30+
{
31+
.custom instance void [System.Runtime]System.Runtime.CompilerServices.InlineArrayAttribute::.ctor(int32) = (
32+
01 00 01 00 00 00 00 00
33+
)
34+
35+
.size 256
36+
.field [0] public valuetype [System.Runtime]System.Guid Guid
37+
}
38+
2839
.class public sequential ansi sealed beforefieldinit ZeroLength
2940
extends [System.Runtime]System.ValueType
3041
{

0 commit comments

Comments
 (0)