11c91d9bdSPeter Klausler! RUN: %python %S/test_errors.py %s %flang_fc1 -pedantic 248b6f5c7SPeixin Qiao! Check for C1801 - C1805 348b6f5c7SPeixin Qiao 448b6f5c7SPeixin Qiaomodule m 548b6f5c7SPeixin Qiao public s 6bd87f2dfSPeter Klausler !ERROR: Interoperable array must have at least one element 7bd87f2dfSPeter Klausler real, bind(c) :: x(0) 848b6f5c7SPeixin Qiaocontains 948b6f5c7SPeixin Qiao subroutine s 1048b6f5c7SPeixin Qiao end 1148b6f5c7SPeixin Qiaoend 1248b6f5c7SPeixin Qiao 1348b6f5c7SPeixin Qiaoprogram main 1448b6f5c7SPeixin Qiao use m 1548b6f5c7SPeixin Qiao type, abstract :: v 1648b6f5c7SPeixin Qiao integer :: i 1748b6f5c7SPeixin Qiao end type 1848b6f5c7SPeixin Qiao 1990501be3SPeter Klausler ! ERROR: An interoperable derived type cannot have the SEQUENCE attribute 2048b6f5c7SPeixin Qiao type, bind(c) :: t1 2148b6f5c7SPeixin Qiao sequence 2248b6f5c7SPeixin Qiao integer :: x 2348b6f5c7SPeixin Qiao end type 2448b6f5c7SPeixin Qiao 2590501be3SPeter Klausler ! ERROR: An interoperable derived type cannot have a type parameter 2648b6f5c7SPeixin Qiao type, bind(c) :: t2(k) 2748b6f5c7SPeixin Qiao integer, KIND :: k 2848b6f5c7SPeixin Qiao integer :: x 2948b6f5c7SPeixin Qiao end type 3048b6f5c7SPeixin Qiao 3190501be3SPeter Klausler ! ERROR: A derived type with the BIND attribute cannot be an extended derived type 3248b6f5c7SPeixin Qiao type, bind(c), extends(v) :: t3 3348b6f5c7SPeixin Qiao integer :: x 3448b6f5c7SPeixin Qiao end type 3548b6f5c7SPeixin Qiao 3648b6f5c7SPeixin Qiao type, bind(c) :: t4 3748b6f5c7SPeixin Qiao integer :: x 3848b6f5c7SPeixin Qiao contains 3990501be3SPeter Klausler ! ERROR: An interoperable derived type cannot have a type bound procedure 4048b6f5c7SPeixin Qiao procedure, nopass :: b => s 4148b6f5c7SPeixin Qiao end type 4248b6f5c7SPeixin Qiao 4390501be3SPeter Klausler ! WARNING: A derived type with the BIND attribute should not be empty 4448b6f5c7SPeixin Qiao type, bind(c) :: t5 4548b6f5c7SPeixin Qiao end type 4648b6f5c7SPeixin Qiao 476d1a6851SPeixin Qiao type, bind(c) :: t6 4890501be3SPeter Klausler ! ERROR: An interoperable derived type cannot have a pointer or allocatable component 496d1a6851SPeixin Qiao integer, pointer :: x 506d1a6851SPeixin Qiao end type 516d1a6851SPeixin Qiao 526d1a6851SPeixin Qiao type, bind(c) :: t7 5390501be3SPeter Klausler ! ERROR: An interoperable derived type cannot have a pointer or allocatable component 546d1a6851SPeixin Qiao integer, allocatable :: y 556d1a6851SPeixin Qiao end type 566d1a6851SPeixin Qiao 576d1a6851SPeixin Qiao type :: t8 586d1a6851SPeixin Qiao integer :: x 596d1a6851SPeixin Qiao end type 606d1a6851SPeixin Qiao 6190501be3SPeter Klausler type :: t8a 6290501be3SPeter Klausler integer, pointer :: x 6390501be3SPeter Klausler end type 6490501be3SPeter Klausler 656d1a6851SPeixin Qiao type, bind(c) :: t9 6690501be3SPeter Klausler !WARNING: Derived type of component 'x' of an interoperable derived type should have the BIND attribute 6790501be3SPeter Klausler type(t8) :: x 6890501be3SPeter Klausler !ERROR: Component 'y' of an interoperable derived type must have an interoperable type but does not 6990501be3SPeter Klausler type(t8a) :: y 706d1a6851SPeixin Qiao integer :: z 716d1a6851SPeixin Qiao end type 726d1a6851SPeixin Qiao 734148f276SPeter Klausler type, bind(c) :: t10 7490501be3SPeter Klausler !WARNING: A CHARACTER component of an interoperable type should have length 1 754148f276SPeter Klausler character(len=2) x 764148f276SPeter Klausler end type 774148f276SPeter Klausler type, bind(c) :: t11 784148f276SPeter Klausler !ERROR: Each component of an interoperable derived type must have an interoperable type 794148f276SPeter Klausler character(kind=2) x 804148f276SPeter Klausler end type 814148f276SPeter Klausler type, bind(c) :: t12 8290501be3SPeter Klausler !PORTABILITY: A LOGICAL component of an interoperable type should have the interoperable KIND=C_BOOL 834148f276SPeter Klausler logical(kind=8) x 844148f276SPeter Klausler end type 854148f276SPeter Klausler type, bind(c) :: t13 864148f276SPeter Klausler !ERROR: Each component of an interoperable derived type must have an interoperable type 874148f276SPeter Klausler real(kind=2) x 884148f276SPeter Klausler end type 894148f276SPeter Klausler type, bind(c) :: t14 904148f276SPeter Klausler !ERROR: Each component of an interoperable derived type must have an interoperable type 914148f276SPeter Klausler complex(kind=2) x 924148f276SPeter Klausler end type 93bd87f2dfSPeter Klausler type, bind(c) :: t15 94bd87f2dfSPeter Klausler !ERROR: An array component of an interoperable type must have at least one element 95bd87f2dfSPeter Klausler real :: x(0) 96bd87f2dfSPeter Klausler end type 974148f276SPeter Klausler 98*c596aae4SPeter Klausler interface 99*c596aae4SPeter Klausler subroutine badAssumedLen(x,y,z) bind(c) 100*c596aae4SPeter Klausler !ERROR: A BIND(C) object must have an interoperable type 101*c596aae4SPeter Klausler character(*), pointer :: x 102*c596aae4SPeter Klausler !ERROR: A BIND(C) object must have an interoperable type 103*c596aae4SPeter Klausler character(*), allocatable :: y 104*c596aae4SPeter Klausler character(*) z ! ok 105*c596aae4SPeter Klausler end 106*c596aae4SPeter Klausler end interface 10748b6f5c7SPeixin Qiaoend 108