view gcc/testsuite/gfortran.dg/proc_ptr_33.f90 @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 04ced10e8804
children
line wrap: on
line source

! { dg-do compile }
!
! PR 41733: Proc-pointer conformance checks: Elemental-proc-ptr => non-elemental-procedure
!
! Contributed by James Van Buskirk

module funcs
   implicit none
   abstract interface
      real elemental function fun(x)
         real, intent(in) :: x
      end function
   end interface
contains
  function my_dcos(x)
    real, intent(in) :: x
    real :: my_dcos
    my_dcos = cos(x)
  end function
end module

program start
   use funcs
   implicit none
   procedure(fun), pointer :: f ! { dg-error "Procedure pointer 'f' at .1. shall not be elemental" }
   real x(3)
   x = [1,2,3]
   f => my_dcos     ! { dg-error "Mismatch in PURE attribute" }
   write(*,*) f(x)
end program start