@@ -771,3 +771,54 @@ void StructTypes_overlapping_value_warning_range() {
771771
772772 ecs_fini (world );
773773}
774+
775+ void StructTypes_struct_w_16_alignment () {
776+ #ifndef _MSC_VER
777+ typedef __attribute ((aligned (16 )))
778+ #else
779+ typedef __declspec (align (32 ))
780+ #endif
781+ struct T {
782+ float x ;
783+ float y ;
784+ float z ;
785+ float w ;
786+ } T ;
787+
788+ ecs_world_t * world = ecs_init ();
789+
790+ ECS_COMPONENT (world , T );
791+
792+ ecs_entity_t t = ecs_struct (world , {
793+ .entity = ecs_id (T ),
794+ .members = {
795+ {"x ", ecs_id (ecs_f32_t )},
796+ {"y ", ecs_id (ecs_f32_t )},
797+ {"z ", ecs_id (ecs_f32_t )},
798+ {"w ", ecs_id (ecs_f32_t )}
799+ }
800+ });
801+
802+ test_assert (t != 0 );
803+ test_str (ecs_get_name (world , t ), "T ");
804+
805+ meta_test_struct (world , t , T );
806+ meta_test_member (world , t , T , x , ecs_id (ecs_f32_t ), 1 );
807+ meta_test_member (world , t , T , y , ecs_id (ecs_f32_t ), 1 );
808+ meta_test_member (world , t , T , z , ecs_id (ecs_f32_t ), 1 );
809+ meta_test_member (world , t , T , w , ecs_id (ecs_f32_t ), 1 );
810+
811+ const EcsComponent * cptr = ecs_get (world , t , EcsComponent );
812+ test_assert (cptr != NULL );
813+ test_int (cptr - > size , sizeof (T ));
814+ test_int (cptr - > alignment , 16 );
815+
816+ const EcsMetaType * mptr = ecs_get (world , t , EcsMetaType );
817+ test_assert (mptr != NULL );
818+ test_bool (mptr - > partial , false );
819+ test_bool (mptr - > existing , true );
820+ test_int (mptr - > size , sizeof (T ));
821+ test_int (mptr - > alignment , 16 );
822+
823+ ecs_fini (world );
824+ }
0 commit comments