[J3] Question on Table 10.8: Intrinsic assignment type conformance

Vipul Parekh parekhvs at gmail.com
Thu Jun 13 17:44:33 EDT 2019


Does the following code conform, particularly 'b= f()' assignment shown below?

module b_m
   type :: b_t
      integer :: i = 0
   end type
end module
module e_m
   use b_m, only : b_t
   type, extends(b_t) :: e_t
   end type
contains
   function f() result(r)
      class(b_t), allocatable :: r
      allocate( e_t :: r)
   end function
end module
program p
   use b_m, only : b_t
   use e_m, only : f
   type(b_t) :: b
   b = f()
end program

Two compilers I tried process the code ok, but I have doubt given the
"same derived type as the variable" listed in Table 10.8 for the "type
of expr" in a "variable = expr" assignment.

Thanks,
Vipul Parekh


More information about the J3 mailing list