@@ -1732,6 +1732,52 @@ public partial struct MyStruct3
1732
1732
return ValidateGeneratedCSharpPreviewWindowsBindingsAsync ( inputContents , expectedOutputContents , withAccessSpecifiers : withAccessSpecifiers ) ;
1733
1733
}
1734
1734
1735
+ protected override Task WithPackingTestImpl ( )
1736
+ {
1737
+ const string InputContents = @"struct MyStruct
1738
+ {
1739
+ size_t FixedBuffer[1];
1740
+ };
1741
+ " ;
1742
+
1743
+ const string ExpectedOutputContents = @"using System;
1744
+ using System.Diagnostics.CodeAnalysis;
1745
+ using System.Runtime.InteropServices;
1746
+
1747
+ namespace ClangSharp.Test
1748
+ {
1749
+ [StructLayout(LayoutKind.Sequential, Pack = CustomPackValue)]
1750
+ public partial struct MyStruct
1751
+ {
1752
+ [NativeTypeName(""size_t[1]"")]
1753
+ public _FixedBuffer_e__FixedBuffer FixedBuffer;
1754
+
1755
+ public partial struct _FixedBuffer_e__FixedBuffer
1756
+ {
1757
+ public nuint e0;
1758
+
1759
+ [UnscopedRef]
1760
+ public ref nuint this[int index]
1761
+ {
1762
+ get
1763
+ {
1764
+ return ref AsSpan(int.MaxValue)[index];
1765
+ }
1766
+ }
1767
+
1768
+ [UnscopedRef]
1769
+ public Span<nuint> AsSpan(int length) => MemoryMarshal.CreateSpan(ref e0, length);
1770
+ }
1771
+ }
1772
+ }
1773
+ " ;
1774
+
1775
+ var withPackings = new Dictionary < string , string > {
1776
+ [ "MyStruct" ] = "CustomPackValue"
1777
+ } ;
1778
+ return ValidateGeneratedCSharpPreviewWindowsBindingsAsync ( InputContents , ExpectedOutputContents , withPackings : withPackings ) ;
1779
+ }
1780
+
1735
1781
protected override Task SourceLocationAttributeTestImpl ( )
1736
1782
{
1737
1783
const string InputContents = @"struct MyStruct
0 commit comments