88 lines · plain
1! RUN: %python %S/test_errors.py %s %flang_fc1 -pedantic2! Tests ELEMENTAL subprogram constraints C15100-151023 4!ERROR: An ELEMENTAL subroutine may not have an alternate return dummy argument5elemental subroutine altret(*)6end subroutine7 8elemental subroutine arrarg(a)9 !ERROR: A dummy argument of an ELEMENTAL procedure must be scalar10 real, intent(in) :: a(1)11end subroutine12 13elemental subroutine alloarg(a)14 !ERROR: A dummy argument of an ELEMENTAL procedure may not be ALLOCATABLE15 real, intent(in), allocatable :: a16end subroutine17 18elemental subroutine coarg(a)19 !ERROR: A dummy argument of an ELEMENTAL procedure may not be a coarray20 real, intent(in) :: a[*]21end subroutine22 23elemental subroutine ptrarg(a)24 !ERROR: A dummy argument of an ELEMENTAL procedure may not be a POINTER25 real, intent(in), pointer :: a26end subroutine27 28impure elemental subroutine barearg(a)29 !ERROR: A dummy argument of an ELEMENTAL procedure must have an INTENT() or VALUE attribute30 real :: a31end subroutine32 33elemental function arrf(n)34 integer, value :: n35 !ERROR: The result of an ELEMENTAL function must be scalar36 real :: arrf(n)37end function38 39elemental function allof(n)40 integer, value :: n41 !ERROR: The result of an ELEMENTAL function may not be ALLOCATABLE42 real, allocatable :: allof43end function44 45elemental function ptrf(n)46 integer, value :: n47 !ERROR: The result of an ELEMENTAL function may not be a POINTER48 real, pointer :: ptrf49end function50 51module m52 integer modvar53 type t54 character(:), allocatable :: c55 end type56 type pdt(L)57 integer, len :: L58 end type59 type container60 class(pdt(:)), allocatable :: c61 end type62 contains63 !ERROR: Invalid specification expression for elemental function result: dependence on value of dummy argument 'n'64 elemental character(n) function bad1(n)65 integer, intent(in) :: n66 end67 !ERROR: Invalid specification expression for elemental function result: non-constant inquiry function 'len' not allowed for local object68 elemental character(x%c%len) function bad2(x)69 type(t), intent(in) :: x70 end71 !ERROR: Invalid specification expression for elemental function result: non-constant type parameter inquiry not allowed for local object72 elemental character(x%c%L) function bad3(x)73 class(container), intent(in) :: x74 end75 elemental character(len(x)) function ok1(x) ! ok76 character(*), intent(in) :: x77 end78 elemental character(modvar) function ok2(x) ! ok79 character(*), intent(in) :: x80 end81 elemental character(len(x)) function ok3(x) ! ok82 character(modvar), intent(in) :: x83 end84 elemental character(storage_size(x)) function ok4(x) ! ok85 class(*), intent(in) :: x86 end87end88