aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gfortran.dg/elemental_subroutine_8.f90
blob: c557d3a9d952fbb5ec41ab7995f2d07766c65c5d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
! { dg-do compile }
!
! PR fortran/58099
!
! See also interpretation request F03-0130 in 09-217 and 10-006T5r1.
!
! - ELEMENTAL is only permitted for external names with PROCEDURE/INTERFACE
!   but not for dummy arguments or proc-pointers
! - Using PROCEDURE with an elemental intrinsic as interface name a is valid,
! but doesn't make the proc-pointer/dummy argument elemental
!

  interface
    elemental real function x(y)
      real, intent(in) :: y
    end function x
  end interface
  intrinsic :: sin
  procedure(x) :: xx1 ! OK
  procedure(x), pointer :: xx2 ! { dg-error "Procedure pointer 'xx2' at .1. shall not be elemental" }
  procedure(real), pointer :: pp 
  procedure(sin) :: bar ! OK
  procedure(sin), pointer :: foo ! { dg-error "Procedure pointer 'foo' at .1. shall not be elemental" }
  pp => sin !OK
contains
  subroutine sub1(z) ! { dg-error "Dummy procedure 'z' at .1. shall not be elemental" }
    procedure(x) :: z
  end subroutine sub1
  subroutine sub2(z) ! { dg-error "Procedure pointer 'z' at .1. shall not be elemental" }
    procedure(x), pointer :: z
  end subroutine sub2
  subroutine sub3(z)
    interface
      elemental real function z(y) ! { dg-error "Dummy procedure 'z' at .1. shall not be elemental" }
        real, intent(in) :: y
      end function z
    end interface
  end subroutine sub3
  subroutine sub4(z)
    interface
      elemental real function z(y) ! { dg-error "Procedure pointer 'z' at .1. shall not be elemental" }
        real, intent(in) :: y
      end function z
    end interface
    pointer :: z
  end subroutine sub4
  subroutine sub5(z) ! { dg-error "Dummy procedure 'z' at .1. shall not be elemental" }
    procedure(sin) :: z
  end subroutine sub5
end