1! RUN: %B/test/Semantics/test_errors.sh %s %flang %t
2! 15.5.1 procedure reference constraints and restrictions
3
4subroutine s01(elem, subr)
5  interface
6    elemental real function elem(x)
7      real, intent(in), value :: x
8    end function
9    subroutine subr(dummy)
10      procedure(sin) :: dummy
11    end subroutine
12    subroutine badsubr(dummy)
13      import :: elem
14      !ERROR: A dummy procedure may not be ELEMENTAL
15      procedure(elem) :: dummy
16    end subroutine
17  end interface
18  call subr(cos) ! not an error
19  !ERROR: Non-intrinsic ELEMENTAL procedure 'elem' may not be passed as an actual argument
20  call subr(elem) ! C1533
21end subroutine
22
23module m01
24  procedure(sin) :: elem01
25  interface
26    elemental real function elem02(x)
27      real, value :: x
28    end function
29    subroutine callme(f)
30      external f
31    end subroutine
32  end interface
33 contains
34  elemental real function elem03(x)
35    real, value :: x
36  end function
37  subroutine test
38    call callme(cos) ! not an error
39    !ERROR: Non-intrinsic ELEMENTAL procedure 'elem01' may not be passed as an actual argument
40    call callme(elem01) ! C1533
41    !ERROR: Non-intrinsic ELEMENTAL procedure 'elem02' may not be passed as an actual argument
42    call callme(elem02) ! C1533
43    !ERROR: Non-intrinsic ELEMENTAL procedure 'elem03' may not be passed as an actual argument
44    call callme(elem03) ! C1533
45    !ERROR: Non-intrinsic ELEMENTAL procedure 'elem04' may not be passed as an actual argument
46    call callme(elem04) ! C1533
47   contains
48    elemental real function elem04(x)
49      real, value :: x
50    end function
51  end subroutine
52end module
53
54module m02
55  type :: t
56    integer, pointer :: ptr
57  end type
58  type(t) :: coarray[*]
59 contains
60  subroutine callee(x)
61    type(t), intent(in) :: x
62  end subroutine
63  subroutine test
64    !ERROR: Coindexed object 'coarray' with POINTER ultimate component '%ptr' cannot be associated with dummy argument 'x='
65    call callee(coarray[1]) ! C1537
66  end subroutine
67end module
68