@@ -28,6 +28,17 @@ pub struct MyContainer_float_ {
2828 vec_ : Value < Vec < f32 > > ,
2929}
3030#[ derive( Clone , Record , ByteRepr , VaArg , FnPtrArg , Default ) ]
31+ #[ byte_size( 2 ) ]
32+ pub struct Boxed_short_ {
33+ #[ offset( 0 ) ]
34+ pub value : i16 ,
35+ }
36+ impl Boxed_short_ {
37+ pub fn twice ( mut v : i16 ) -> i16 {
38+ return ( ( ( v as i32 ) + ( v as i32 ) ) as i16 ) ;
39+ }
40+ }
41+ #[ derive( Clone , Record , ByteRepr , VaArg , FnPtrArg , Default ) ]
3142#[ byte_size( 4 ) ]
3243pub struct Boxed_int_ {
3344 #[ offset( 0 ) ]
@@ -85,11 +96,24 @@ pub struct Outer_long_ {
8596 #[ offset( 0 ) ]
8697 pub v : i64 ,
8798}
99+ #[ derive( Clone , Record , ByteRepr , VaArg , FnPtrArg , Default ) ]
100+ #[ byte_size( 4 ) ]
101+ pub struct Elem {
102+ #[ offset( 0 ) ]
103+ pub i : i32 ,
104+ }
88105pub fn main ( ) {
89106 __cpp2rust_init_globals ( ) ;
90107 std:: process:: exit ( main_0 ( ) ) ;
91108}
92109fn main_0 ( ) -> i32 {
110+ let mut ev: Vec < Elem > = Vec :: new ( ) ;
111+ {
112+ let __a1 = Elem { i : 2 } ;
113+ ev. push ( __a1)
114+ } ;
115+ assert ! ( ( { ev[ 0_usize ] . i } == 2 ) ) ;
116+ assert ! ( ( ( ( { Boxed_short_ :: twice( 2_i16 , ) } ) as i32 ) == 4 ) ) ;
93117 let oi: Value < Outer_int_ > = Rc :: new ( RefCell :: new ( Outer_int_ { v : 3 } ) ) ;
94118 assert ! (
95119 ( ( {
@@ -181,6 +205,14 @@ impl Boxed_long_Impl for Ptr<Boxed_long_> {
181205 return ( ( * self ) . with ( |__s| __s. value ) + other) ;
182206 }
183207}
208+ pub trait Boxed_short_Impl {
209+ fn plus ( & self , other : i16 ) -> i16 ;
210+ }
211+ impl Boxed_short_Impl for Ptr < Boxed_short_ > {
212+ fn plus ( & self , mut other : i16 ) -> i16 {
213+ return ( ( ( ( * self ) . with ( |__s| __s. value ) as i32 ) + ( other as i32 ) ) as i16 ) ;
214+ }
215+ }
184216pub trait MyContainer_char_Impl {
185217 fn empty ( & self ) -> bool ;
186218 fn size ( & self ) -> usize ;
0 commit comments