[J3] Question about interface matchine

Vipul Parekh parekhvs at gmail.com
Wed Jan 27 23:52:42 UTC 2021

On Wed, Jan 27, 2021 at 5:24 PM Brad Richardson via J3 <
j3 at mailman.j3-fortran.org> wrote:

> Hi all,
> .. I contend that both the declared and dynamic type of bar do not match
> the interface ..

Hi Brad,

The declared type of 'bar' is 'foo_t' which matches the type of the dummy
argument 'rhs', thus looks conformant.

The standard, since Fortran 2003, has been clear, "A nonpolymorphic entity
is type compatible only with entities of the same declared type. A
polymorphic entity that is not an unlimited polymorphic entity is type
compatible with entities of the same declared type or any of its

Did you intend for the main program declaration to be "class(bar_t),
allocatable :: bar"? instead of "class(foo_t), .."?  In this case, yes
you'd be correct - the type compatibility requirements in the standard will
not be met and the code will not conform.

Vipul Parekh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20210127/892240d0/attachment.htm>

More information about the J3 mailing list