2017-12-08 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gfortran.dg / proc_ptr_33.f90
blob30014610a01eb10a8cf9023842970a2002101e26
1 ! { dg-do compile }
3 ! PR 41733: Proc-pointer conformance checks: Elemental-proc-ptr => non-elemental-procedure
5 ! Contributed by James Van Buskirk
7 module funcs
8 implicit none
9 abstract interface
10 real elemental function fun(x)
11 real, intent(in) :: x
12 end function
13 end interface
14 contains
15 function my_dcos(x)
16 real, intent(in) :: x
17 real :: my_dcos
18 my_dcos = cos(x)
19 end function
20 end module
22 program start
23 use funcs
24 implicit none
25 procedure(fun), pointer :: f ! { dg-error "Procedure pointer 'f' at .1. shall not be elemental" }
26 real x(3)
27 x = [1,2,3]
28 f => my_dcos ! { dg-error "Mismatch in PURE attribute" }
29 write(*,*) f(x)
30 end program start