File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -1468,5 +1468,26 @@ SUITE( fbc_tests.structs.padding )
14681468 CU_ASSERT( x2.x1.i = 11 )
14691469 CU_ASSERT( x2.b = 22 )
14701470 END_TEST
1471+
1472+ TEST( genGccUdtPackedFieldInUdt )
1473+ '' Regression test for -gen gcc's struct emitting
1474+
1475+ type UDT1 field= 1 '' packed UDT
1476+ a as byte '' 1 byte
1477+ b as short '' 2 bytes
1478+ end type
1479+ #assert sizeof( UDT1 ) = sizeof( byte ) + sizeof ( short )
1480+ #assert sizeof( UDT1 ) = 3
14711481
1482+ type UDT2 field= 2 '' packed UDT
1483+ x1 as UDT1 '' UDT field, which is packed with field=1
1484+ end type
1485+ #assert sizeof( UDT2 ) = 4
1486+ #assert offsetof(UDT2, x1.b) = 1
1487+
1488+ dim x2 as UDT2 = (( 11 , 22 ))
1489+ CU_ASSERT( x2.x1.a = 11 )
1490+ CU_ASSERT( x2.x1.b = 22 )
1491+ END_TEST
1492+
14721493END_SUITE
You can’t perform that action at this time.
0 commit comments