@@ -6,6 +6,16 @@ use std::collections::BTreeMap;
66use std:: io:: { Read , Seek , Write } ;
77use std:: os:: fd:: { AsFd , FromRawFd , IntoRawFd } ;
88use std:: rc:: Rc ;
9+ pub unsafe fn test_0 ( ) {
10+ let mut value: i32 = 5 ;
11+ let mut ptr: * mut i32 = ( & mut value as * mut i32 ) ;
12+ let mut ptr_ptr: * mut * mut i32 = ( & mut ptr as * mut * mut i32 ) ;
13+ let mut converted: * const * const i32 = ( ptr_ptr as * const * const i32 ) ;
14+ assert ! ( ( ( converted) == ( ptr_ptr as * const * const i32 ) ) ) ;
15+ assert ! ( ( ( * converted) == ( ( ptr) . cast_const( ) ) ) ) ;
16+ value = 7 ;
17+ assert ! ( ( ( * ( * converted) ) == ( 7 ) ) ) ;
18+ }
919#[ repr( C ) ]
1020#[ derive( Copy , Clone , VaArg , FnPtrArg , Default ) ]
1121pub struct p10_null_converts_to_null_HasTwoInts {
@@ -17,7 +27,7 @@ pub struct p10_null_converts_to_null_HasTwoInts {
1727pub struct p10_null_converts_to_null_HasChar {
1828 pub character : libc:: c_char ,
1929}
20- pub unsafe fn test_0 ( ) {
30+ pub unsafe fn test_1 ( ) {
2131 let mut pm: isize = -1_isize ;
2232 let mut converted: isize = pm;
2333 assert ! ( ( ( converted) == -1_isize ) ) ;
@@ -33,7 +43,7 @@ pub struct p10_2_data_member_round_trip_HasTwoInts {
3343pub struct p10_2_data_member_round_trip_HasChar {
3444 pub character : libc:: c_char ,
3545}
36- pub unsafe fn test_1 ( ) {
46+ pub unsafe fn test_2 ( ) {
3747 let mut converted: isize =
3848 ( :: std:: mem:: offset_of!( p10_2_data_member_round_trip_HasTwoInts, second) as isize ) ;
3949 let mut back: isize = converted;
@@ -62,6 +72,7 @@ pub fn main() {
6272unsafe fn main_0 ( ) -> i32 {
6373 ( unsafe { test_0 ( ) } ) ;
6474 ( unsafe { test_1 ( ) } ) ;
75+ ( unsafe { test_2 ( ) } ) ;
6576 return 0 ;
6677}
6778pub unsafe fn __cpp2rust_init_globals ( ) { }
0 commit comments