diff options
Diffstat (limited to 'gcc/testsuite/gfortran.dg/proc_ptr_result_7.f90')
-rw-r--r-- | gcc/testsuite/gfortran.dg/proc_ptr_result_7.f90 | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_result_7.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_result_7.f90 new file mode 100644 index 0000000000..b77e40b7b6 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/proc_ptr_result_7.f90 @@ -0,0 +1,34 @@ +! { dg-do run } +! +! PR 54285: [F03] Calling a PPC with proc-ptr result +! +! Contributed by Janus Weil <janus@gcc.gnu.org> + +type :: t + procedure(a), pointer, nopass :: p +end type + +type(t) :: x + +! We cannot use "iabs" directly as it is elemental. +abstract interface + pure integer function interf_iabs(x) + integer, intent(in) :: x + end function interf_iabs +end interface +procedure(interf_iabs), pointer :: pp + +x%p => a + +pp => x%p() + +if (pp(-3) /= 3) call abort + +contains + + function a() result (b) + procedure(interf_iabs), pointer :: b + b => iabs + end function + +end |