[J3] Question on Table 10.8: Intrinsic assignment type conformance
Bill Long
longb at cray.com
Thu Jun 13 18:02:11 EDT 2019
Gets a warning message:
> ftn test.f90
function f() result(r)
^
ftn-287 crayftn: WARNING F, File = test.f90, Line = 12, Column = 23
The result of function name "R" in the function subprogram is not defined.
prompted by this statement in the standard:
"If the function result is not a pointer, its value shall be defined by the function.” The function result declaration says “not a pointer”.
Cheers,
Bill
> On Jun 13, 2019, at 4:44 PM, Vipul Parekh via J3 <j3 at mailman.j3-fortran.org> wrote:
>
> 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
Bill Long longb at cray.com
Principal Engineer, Fortran Technical Support & voice: 651-605-9024
Bioinformatics Software Development fax: 651-605-9143
Cray Inc./ 2131 Lindau Lane/ Suite 1000/ Bloomington, MN 55425
More information about the J3
mailing list