| 1 |
! { dg-do compile } |
| 2 |
module bind_c_dts_3 |
| 3 |
use, intrinsic :: iso_c_binding |
| 4 |
implicit none |
| 5 |
|
| 6 |
TYPE, bind(c) :: t |
| 7 |
integer(c_int) :: i |
| 8 |
end type t |
| 9 |
|
| 10 |
type :: my_c_type_0 ! { dg-error "must have the BIND attribute" } |
| 11 |
integer(c_int) :: i |
| 12 |
end type my_c_type_0 |
| 13 |
|
| 14 |
type, 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" } |
| 18 |
end type my_c_type_1 |
| 19 |
|
| 20 |
type, bind(c) :: t2 ! { dg-error "BIND.C. derived type" } |
| 21 |
type (t2), pointer :: next ! { dg-error "cannot have the POINTER" } |
| 22 |
end type t2 |
| 23 |
|
| 24 |
type, bind(c):: t3 ! { dg-error "BIND.C. derived type" } |
| 25 |
type(t), allocatable :: c(:) ! { dg-error "cannot have the ALLOCATABLE" } |
| 26 |
end type t3 |
| 27 |
|
| 28 |
contains |
| 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 |
STOP 1 |
| 35 |
end if |
| 36 |
end subroutine sub0 |
| 37 |
end module bind_c_dts_3 |