@@ -36,6 +36,28 @@ thread_local!(
3636 buf: Box :: new( [ 0 ; 4 ] ) ,
3737 } ) ) ;
3838) ;
39+ #[ derive( Clone , Record , ByteRepr , VaArg , FnPtrArg , Default ) ]
40+ #[ byte_size( 8 ) ]
41+ pub struct P {
42+ #[ offset( 0 ) ]
43+ pub x : i32 ,
44+ #[ offset( 4 ) ]
45+ pub y : i32 ,
46+ }
47+ thread_local ! (
48+ pub static g_1: Value <Box <[ i32 ] >> = Rc :: new( RefCell :: new( Box :: new( [ 0_i32 ; 5 ] ) ) ) ;
49+ ) ;
50+ thread_local ! (
51+ pub static k_2: Value <Box <[ i32 ] >> = Rc :: new( RefCell :: new( Box :: new( [
52+ 3 , 0 , 4 , 0_i32 , 0_i32 , 0_i32 , 0_i32 , 0_i32 ,
53+ ] ) ) ) ;
54+ ) ;
55+ thread_local ! (
56+ pub static counter_3: Value <i32 > = Rc :: new( RefCell :: new( 0 ) ) ;
57+ ) ;
58+ pub fn next_counter_4 ( ) -> i32 {
59+ return ( * ( * counter_3. with ( Value :: clone) . borrow_mut ( ) ) . prefix_inc ( ) ) ;
60+ }
3961pub fn main ( ) {
4062 __cpp2rust_init_globals ( ) ;
4163 std:: process:: exit ( main_0 ( ) ) ;
@@ -56,8 +78,83 @@ fn main_0() -> i32 {
5678 i. postfix_inc ( ) ;
5779 }
5880 }
81+ let mut a: [ i32 ; 10 ] = [ 0_i32 ; 10 ] ;
82+ {
83+ let mut i: i32 = 0 ;
84+ ' loop_: while ( i < 10 ) {
85+ assert ! ( ( a[ ( i) as usize ] == 0 ) ) ;
86+ i. postfix_inc ( ) ;
87+ }
88+ }
89+ let mut seven: [ i32 ; 4 ] = [ 7 , 0_i32 , 0_i32 , 0_i32 ] ;
90+ assert ! ( ( seven[ ( 0 ) as usize ] == 7 ) ) ;
91+ {
92+ let mut i: i32 = 1 ;
93+ ' loop_: while ( i < 4 ) {
94+ assert ! ( ( seven[ ( i) as usize ] == 0 ) ) ;
95+ i. postfix_inc ( ) ;
96+ }
97+ }
98+ let mut b: [ i32 ; 6 ] = [ 1 , 0 , 2 , 0_i32 , 0_i32 , 0_i32 ] ;
99+ assert ! ( ( ( ( b[ ( 0 ) as usize ] == 1 ) && ( b[ ( 1 ) as usize ] == 0 ) ) && ( b[ ( 2 ) as usize ] == 2 ) ) ) ;
100+ {
101+ let mut i: i32 = 3 ;
102+ ' loop_: while ( i < 6 ) {
103+ assert ! ( ( b[ ( i) as usize ] == 0 ) ) ;
104+ i. postfix_inc ( ) ;
105+ }
106+ }
107+ let mut d: [ f64 ; 4 ] = [ -0_f64 , 0_f64 , 0_f64 , 0_f64 ] ;
108+ assert ! ( ( ( d[ ( 0 ) as usize ] == 0_f64 ) && ( d[ ( 3 ) as usize ] == 0_f64 ) ) ) ;
109+ let mut p: [ P ; 4 ] = [
110+ P { x : 1 , y : 2 } ,
111+ <P >:: default ( ) ,
112+ <P >:: default ( ) ,
113+ <P >:: default ( ) ,
114+ ] ;
115+ assert ! ( ( ( p[ ( 0 ) as usize ] . x == 1 ) && ( p[ ( 0 ) as usize ] . y == 2 ) ) ) ;
116+ assert ! ( ( ( p[ ( 3 ) as usize ] . x == 0 ) && ( p[ ( 3 ) as usize ] . y == 0 ) ) ) ;
117+ let mut c: [ i32 ; 5 ] = [
118+ ( { next_counter_4 ( ) } ) ,
119+ ( { next_counter_4 ( ) } ) ,
120+ 0_i32 ,
121+ 0_i32 ,
122+ 0_i32 ,
123+ ] ;
124+ assert ! ( ( ( ( c[ ( 0 ) as usize ] + c[ ( 1 ) as usize ] ) == 3 ) && ( c[ ( 4 ) as usize ] == 0 ) ) ) ;
125+ let mut t: [ i32 ; 2 ] = [ 0_i32 ; 2 ] ;
126+ assert ! ( ( ( t[ ( 0 ) as usize ] == 0 ) && ( t[ ( 1 ) as usize ] == 0 ) ) ) ;
127+ let mut u: [ i32 ; 3 ] = [ 5 , 6 , 0_i32 ] ;
128+ assert ! ( ( ( ( u[ ( 0 ) as usize ] == 5 ) && ( u[ ( 1 ) as usize ] == 6 ) ) && ( u[ ( 2 ) as usize ] == 0 ) ) ) ;
129+ assert ! (
130+ ( ( {
131+ let __idx0 = ( 4 ) as usize ;
132+ g_1. with( |rc| rc. borrow( ) [ __idx0] )
133+ } ) == 0 )
134+ ) ;
135+ assert ! (
136+ ( ( ( ( ( {
137+ let __idx0 = ( 0 ) as usize ;
138+ k_2. with( |rc| rc. borrow( ) [ __idx0] )
139+ } ) == 3 )
140+ && ( ( {
141+ let __idx0 = ( 1 ) as usize ;
142+ k_2. with( |rc| rc. borrow( ) [ __idx0] )
143+ } ) == 0 ) )
144+ && ( ( {
145+ let __idx0 = ( 2 ) as usize ;
146+ k_2. with( |rc| rc. borrow( ) [ __idx0] )
147+ } ) == 4 ) )
148+ && ( ( {
149+ let __idx0 = ( 7 ) as usize ;
150+ k_2. with( |rc| rc. borrow( ) [ __idx0] )
151+ } ) == 0 ) )
152+ ) ;
59153 return 0 ;
60154}
61155pub fn __cpp2rust_init_globals ( ) {
62156 let _ = s_0. with ( |_| ( ) ) ;
157+ let _ = g_1. with ( |_| ( ) ) ;
158+ let _ = k_2. with ( |_| ( ) ) ;
159+ let _ = counter_3. with ( |_| ( ) ) ;
63160}
0 commit comments