| 1 |
! { dg-do compile } |
| 2 |
! |
| 3 |
! PR 41733: Proc-pointer conformance checks: Elemental-proc-ptr => non-elemental-procedure |
| 4 |
! |
| 5 |
! Contributed by James Van Buskirk |
| 6 |
|
| 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 |
| 21 |
|
| 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 |