[J3] Question on parent component naming

Bader, Reinhold Reinhold.Bader at lrz.de
Mon Apr 8 14:21:56 UTC 2024


Dear J3,

consider the following program:

MODULE mod
   TYPE :: t
      REAL, POINTER :: p(:) => null()
   END TYPE

END MODULE
PROGRAM ref_parent
   USE mod, my_t => t

   TYPE, EXTENDS(my_t) :: td
     REAL :: data(3)
   END TYPE

   TYPE(td), TARGET :: o_my_t

   o_my_t%my_t = my_t(o_my_t%data)  ! (x)
   ! o_my_t%t = my_t(o_my_t%data)       ! (y)

END PROGRAM

Two compilers accept this code. Two other compilers tell me that my_t is not a parent component of o_my_t, at (x)
One of those two others accepts the variant statement (y), the other one crashes when (y) is used.

I tend to believe that the above is conforming, but this is based on non-normative evidence (NOTE 1 in 7.5.7.1 of 24-007).

Any opinions?

Regards
Reinhold
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20240408/a9d03d4f/attachment.htm>


More information about the J3 mailing list