| 1 | ! audit31 Finding 8: `cb => proc` where proc is a `procedure(iface)` |
| 2 | ! dummy argument used to fail with "pointer assignment source |
| 3 | ! must have target or pointer attribute". F2003 allows a dummy |
| 4 | ! procedure as the RHS of a procedure-pointer '=>'; relax the |
| 5 | ! sema check to accept symbols carrying attrs.external (which is |
| 6 | ! how `procedure(iface) :: proc` is lowered) in addition to the |
| 7 | ! Function/Subroutine kinds. Task #489. |
| 8 | ! CHECK: ok |
| 9 | module audit31_procptr_dummy |
| 10 | implicit none |
| 11 | abstract interface |
| 12 | subroutine iface(x) |
| 13 | integer, intent(in) :: x |
| 14 | end subroutine |
| 15 | end interface |
| 16 | procedure(iface), pointer :: cb => null() |
| 17 | contains |
| 18 | subroutine set_cb(proc) |
| 19 | procedure(iface) :: proc |
| 20 | cb => proc |
| 21 | end subroutine |
| 22 | end module |
| 23 | |
| 24 | program audit31_procptr_dummy_driver |
| 25 | use audit31_procptr_dummy |
| 26 | implicit none |
| 27 | print *, 'ok' |
| 28 | end program |
| 29 |