1! { dg-do compile } 2module bind_c_dts_3 3use, intrinsic :: iso_c_binding 4implicit none 5 6TYPE, bind(c) :: t 7 integer(c_int) :: i 8end type t 9 10type :: my_c_type_0 ! { dg-error "must have the BIND attribute" } 11 integer(c_int) :: i 12end type my_c_type_0 13 14type, bind(c) :: my_c_type_1 ! { dg-error "BIND.C. derived type" } 15 type(my_c_type_0) :: my_nested_type 16 type(c_ptr) :: c_address 17 integer(c_int), pointer :: j ! { dg-error "cannot have the POINTER" } 18end type my_c_type_1 19 20type, bind(c) :: t2 ! { dg-error "BIND.C. derived type" } 21 type (t2), pointer :: next ! { dg-error "cannot have the POINTER" } 22end type t2 23 24type, bind(c):: t3 ! { dg-error "BIND.C. derived type" } 25 type(t), allocatable :: c(:) ! { dg-error "cannot have the ALLOCATABLE" } 26end type t3 27 28contains 29 subroutine sub0(my_type, expected_value) bind(c) 30 type(my_c_type_1) :: my_type 31 integer(c_int), value :: expected_value 32 33 if (my_type%my_nested_type%i .ne. expected_value) then 34 call abort () 35 end if 36 end subroutine sub0 37end module bind_c_dts_3 38