[J3] Can a type-bound procedure be passed as an actual argument
Daniel C Chen
cdchen at ca.ibm.com
Wed Jan 11 18:33:55 UTC 2023
Hi Vipul,
Yeah, I assumed I had the explicit interface for sub1. I still go the same result. I added it to both cases to avoid confusion.
Case 1:
type dt
contains
procedure, nopass :: foo => real_foo
end type
interface
subroutine real_foo()
end
subroutine sub1(arg)
interface
subroutine arg()
end
end interface
end
end interface
type(dt) :: t1
call sub1(t1%foo) !!! Is it legal to pass t1%foo as actual argument?
End
Case 2:
module m
type dt
contains
procedure :: foo => real_foo
end type
contains
subroutine real_foo(this)
class(dt) :: this
end
end
program main
use m
interface
subroutine sub1(arg)
import
class(dt) :: arg
end subroutine
end interface
type(dt) :: t1
call sub1(t1%foo)
end
From: Vipul Parekh <parekhvs at gmail.com>
Sent: January 11, 2023 1:26 PM
To: General J3 interest list <j3 at mailman.j3-fortran.org>
Cc: Daniel C Chen <cdchen at ca.ibm.com>
Subject: [EXTERNAL] Re: [J3] Can a type-bound procedure be passed as an actual argument
On Wed, Jan 11, 2023 at 1: 08 PM Daniel C Chen via J3 <j3@ mailman. j3-fortran. org> wrote: .. I couldn’t find any wording in the standard (F2018) that prohibits the two usages above, and yet a couple of compilers that I have access to flags
ZjQcmQRYFpfptBannerStart
This Message Is From an Untrusted Sender
You have not previously corresponded with this sender.
ZjQcmQRYFpfptBannerEnd
On Wed, Jan 11, 2023 at 1:08 PM Daniel C Chen via J3 <j3 at mailman.j3-fortran.org<mailto:j3 at mailman.j3-fortran.org>> wrote:
..
I couldn’t find any wording in the standard (F2018) that prohibits the two usages above, and yet a couple of compilers that I have access to flags error message...
Hi Daniel,
Did you forget to include the interface for your `sub1`?
Regards,
Vipul
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20230111/eb2307ef/attachment-0001.htm>
More information about the J3
mailing list