Break circular dependency between FIR dialect and utilities
[llvm-project.git] / flang / test / Semantics / elemental01.f90
blob8a80727da45efcc076fd42fda41aa00bf66b9a54
1 ! RUN: %python %S/test_errors.py %s %flang_fc1
2 ! Tests ELEMENTAL subprogram constraints C15100-15102
4 !ERROR: An ELEMENTAL subroutine may not have an alternate return dummy argument
5 elemental subroutine altret(*)
6 end subroutine
8 elemental subroutine arrarg(a)
9 !ERROR: A dummy argument of an ELEMENTAL procedure must be scalar
10 real, intent(in) :: a(1)
11 end subroutine
13 elemental subroutine alloarg(a)
14 !ERROR: A dummy argument of an ELEMENTAL procedure may not be ALLOCATABLE
15 real, intent(in), allocatable :: a
16 end subroutine
18 elemental subroutine coarg(a)
19 !ERROR: A dummy argument of an ELEMENTAL procedure may not be a coarray
20 real, intent(in) :: a[*]
21 end subroutine
23 elemental subroutine ptrarg(a)
24 !ERROR: A dummy argument of an ELEMENTAL procedure may not be a POINTER
25 real, intent(in), pointer :: a
26 end subroutine
28 impure elemental subroutine barearg(a)
29 !ERROR: A dummy argument of an ELEMENTAL procedure must have an INTENT() or VALUE attribute
30 real :: a
31 end subroutine
33 elemental function arrf(n)
34 integer, value :: n
35 !ERROR: The result of an ELEMENTAL function must be scalar
36 real :: arrf(n)
37 end function
39 elemental function allof(n)
40 integer, value :: n
41 !ERROR: The result of an ELEMENTAL function may not be ALLOCATABLE
42 real, allocatable :: allof
43 end function
45 elemental function ptrf(n)
46 integer, value :: n
47 !ERROR: The result of an ELEMENTAL function may not be a POINTER
48 real, pointer :: ptrf
49 end function