1! RUN: %python %S/test_errors.py %s %flang_fc1 -pedantic 2! Check for C1801 - C1805 3 4module m 5 public s 6 !ERROR: Interoperable array must have at least one element 7 real, bind(c) :: x(0) 8contains 9 subroutine s 10 end 11end 12 13program main 14 use m 15 type, abstract :: v 16 integer :: i 17 end type 18 19 ! ERROR: An interoperable derived type cannot have the SEQUENCE attribute 20 type, bind(c) :: t1 21 sequence 22 integer :: x 23 end type 24 25 ! ERROR: An interoperable derived type cannot have a type parameter 26 type, bind(c) :: t2(k) 27 integer, KIND :: k 28 integer :: x 29 end type 30 31 ! ERROR: A derived type with the BIND attribute cannot be an extended derived type 32 type, bind(c), extends(v) :: t3 33 integer :: x 34 end type 35 36 type, bind(c) :: t4 37 integer :: x 38 contains 39 ! ERROR: An interoperable derived type cannot have a type bound procedure 40 procedure, nopass :: b => s 41 end type 42 43 ! WARNING: A derived type with the BIND attribute should not be empty 44 type, bind(c) :: t5 45 end type 46 47 type, bind(c) :: t6 48 ! ERROR: An interoperable derived type cannot have a pointer or allocatable component 49 integer, pointer :: x 50 end type 51 52 type, bind(c) :: t7 53 ! ERROR: An interoperable derived type cannot have a pointer or allocatable component 54 integer, allocatable :: y 55 end type 56 57 type :: t8 58 integer :: x 59 end type 60 61 type :: t8a 62 integer, pointer :: x 63 end type 64 65 type, bind(c) :: t9 66 !WARNING: Derived type of component 'x' of an interoperable derived type should have the BIND attribute 67 type(t8) :: x 68 !ERROR: Component 'y' of an interoperable derived type must have an interoperable type but does not 69 type(t8a) :: y 70 integer :: z 71 end type 72 73 type, bind(c) :: t10 74 !WARNING: A CHARACTER component of an interoperable type should have length 1 75 character(len=2) x 76 end type 77 type, bind(c) :: t11 78 !ERROR: Each component of an interoperable derived type must have an interoperable type 79 character(kind=2) x 80 end type 81 type, bind(c) :: t12 82 !PORTABILITY: A LOGICAL component of an interoperable type should have the interoperable KIND=C_BOOL 83 logical(kind=8) x 84 end type 85 type, bind(c) :: t13 86 !ERROR: Each component of an interoperable derived type must have an interoperable type 87 real(kind=2) x 88 end type 89 type, bind(c) :: t14 90 !ERROR: Each component of an interoperable derived type must have an interoperable type 91 complex(kind=2) x 92 end type 93 type, bind(c) :: t15 94 !ERROR: An array component of an interoperable type must have at least one element 95 real :: x(0) 96 end type 97 98 interface 99 subroutine badAssumedLen(x,y,z) bind(c) 100 !ERROR: A BIND(C) object must have an interoperable type 101 character(*), pointer :: x 102 !ERROR: A BIND(C) object must have an interoperable type 103 character(*), allocatable :: y 104 character(*) z ! ok 105 end 106 end interface 107end 108