99 lines · plain
1! RUN: %python %S/test_errors.py %s %flang_fc12! Structural equivalence of derived type definitions3module m4 interface5 module subroutine s1(x)6 type :: nonseq7 integer :: n8 end type9 type(nonseq), intent(in) :: x10 end subroutine11 module subroutine s2(x)12 type :: seq13 sequence14 integer :: n15 end type16 type(seq), intent(in) :: x17 end subroutine18 module subroutine s3(x)19 type :: chlen20 sequence21 character(2) :: s22 end type23 type(chlen), intent(in) :: x24 end subroutine25 module subroutine s4(x)26 !ERROR: A sequence type may not have type parameters27 type :: pdt(k)28 integer, kind :: k29 sequence30 real(k) :: a31 end type32 type(pdt(4)), intent(in) :: x33 end subroutine34 end interface35end module36 37submodule(m) sm38 contains39 module subroutine s1(x)40 type :: nonseq41 integer :: n42 end type43 !ERROR: Dummy argument 'x' has type nonseq; the corresponding argument in the interface body has distinct type nonseq44 type(nonseq), intent(in) :: x45 end subroutine46 module subroutine s2(x) ! ok47 type :: seq48 sequence49 integer :: n50 end type51 type(seq), intent(in) :: x52 end subroutine53 module subroutine s3(x)54 type :: chlen55 sequence56 character(3) :: s ! note: length is 3, not 257 end type58 !ERROR: Dummy argument 'x' has type chlen; the corresponding argument in the interface body has distinct type chlen59 type(chlen), intent(in) :: x60 end subroutine61 module subroutine s4(x)62 !ERROR: A sequence type may not have type parameters63 type :: pdt(k)64 integer, kind :: k65 sequence66 real(k) :: a67 end type68 !ERROR: Dummy argument 'x' has type pdt(k=4_4); the corresponding argument in the interface body has distinct type pdt(k=4_4)69 type(pdt(4)), intent(in) :: x70 end subroutine71end submodule72 73program main74 use m75 type :: nonseq76 integer :: n77 end type78 type :: seq79 sequence80 integer :: n81 end type82 type :: chlen83 sequence84 character(2) :: s85 end type86 !ERROR: A sequence type may not have type parameters87 type :: pdt(k)88 integer, kind :: k89 sequence90 real(k) :: a91 end type92 !ERROR: Actual argument type 'nonseq' is not compatible with dummy argument type 'nonseq'93 call s1(nonseq(1))94 call s2(seq(1)) ! ok95 call s3(chlen('ab')) ! ok, matches interface96 !ERROR: Actual argument type 'pdt(k=4_4)' is not compatible with dummy argument type 'pdt(k=4_4)'97 call s4(pdt(4)(3.14159))98end program99