@@ -210,3 +210,35 @@ fn test_raw_identifier_field() {
210210 assert ! ( result. is_ok( ) ) ;
211211 }
212212}
213+
214+ #[ test]
215+ fn test_mismatched_union_field_ty ( ) {
216+ let include_path = PathBuf :: from ( "tests/input" ) ;
217+ let crate_path = include_path. join ( "mismatched_union_field_ty.rs" ) ;
218+ let library_path = "mismatched_union_field_ty.out.a" ;
219+
220+ let ( mut gen_, _out_dir) = default_generator ( 1 , Some ( "mismatched_union_field_ty.h" ) ) . unwrap ( ) ;
221+
222+ if env:: var ( "TARGET_PLATFORM" ) == env:: var ( "HOST_PLATFORM" ) {
223+ let result = generate_test ( & mut gen_, & crate_path, library_path) ;
224+ assert ! ( result. is_err( ) ) ;
225+ // As cc prints its warning/error messages to stderr, we cannot access them from cc::Error,
226+ // and so cannot assert that the error was actually due to -Wincompatible-pointer-types.
227+ }
228+ }
229+
230+ #[ test]
231+ fn test_mismatched_struct_field_ty ( ) {
232+ let include_path = PathBuf :: from ( "tests/input" ) ;
233+ let crate_path = include_path. join ( "mismatched_struct_field_ty.rs" ) ;
234+ let library_path = "mismatched_struct_field_ty.out.a" ;
235+
236+ let ( mut gen_, _out_dir) = default_generator ( 1 , Some ( "mismatched_struct_field_ty.h" ) ) . unwrap ( ) ;
237+
238+ if env:: var ( "TARGET_PLATFORM" ) == env:: var ( "HOST_PLATFORM" ) {
239+ let result = generate_test ( & mut gen_, & crate_path, library_path) ;
240+ assert ! ( result. is_err( ) ) ;
241+ // FIXME(ctest): As cc prints its warning/error messages to stderr, we cannot access them from cc::Error,
242+ // and so cannot assert that the error was actually due to -Wincompatible-pointer-types.
243+ }
244+ }
0 commit comments