module m implicit none type t contains procedure, nopass :: hello end type t contains subroutine foo() associate (var => bar()) call var%hello() end associate end subroutine foo subroutine hello print *, 'Hello' end type(t) function bar() end end module m program test use m call foo() end program test