Files
clang-p2996/flang/test/Semantics/elemental01.f90
peter klausler 1062f989af [flang] Expunge bogus semantic check for ELEMENTAL without dummies
Semantics refuses valid ELEMENTAL subprograms without dummy arguments,
but there's no such constraint in the standard; indeed, subclause
15.8.2 discusses the meaning of calls to ELEMENTAL functions with
arguments.  Remove the check and its test.

Differential Revision: https://reviews.llvm.org/D111832
2021-10-14 14:33:30 -07:00

50 lines
1.4 KiB
Fortran

! RUN: %python %S/test_errors.py %s %flang_fc1
! Tests ELEMENTAL subprogram constraints C15100-15102
!ERROR: An ELEMENTAL subroutine may not have an alternate return dummy argument
elemental subroutine altret(*)
end subroutine
elemental subroutine arrarg(a)
!ERROR: A dummy argument of an ELEMENTAL procedure must be scalar
real, intent(in) :: a(1)
end subroutine
elemental subroutine alloarg(a)
!ERROR: A dummy argument of an ELEMENTAL procedure may not be ALLOCATABLE
real, intent(in), allocatable :: a
end subroutine
elemental subroutine coarg(a)
!ERROR: A dummy argument of an ELEMENTAL procedure may not be a coarray
real, intent(in) :: a[*]
end subroutine
elemental subroutine ptrarg(a)
!ERROR: A dummy argument of an ELEMENTAL procedure may not be a POINTER
real, intent(in), pointer :: a
end subroutine
impure elemental subroutine barearg(a)
!ERROR: A dummy argument of an ELEMENTAL procedure must have an INTENT() or VALUE attribute
real :: a
end subroutine
elemental function arrf(n)
integer, value :: n
!ERROR: The result of an ELEMENTAL function must be scalar
real :: arrf(n)
end function
elemental function allof(n)
integer, value :: n
!ERROR: The result of an ELEMENTAL function may not be ALLOCATABLE
real, allocatable :: allof
end function
elemental function ptrf(n)
integer, value :: n
!ERROR: The result of an ELEMENTAL function may not be a POINTER
real, pointer :: ptrf
end function