09-237 To: J3 From: Tobias Burnus Subject: Recursive constraint for specific calling same-named generic procedure Date: 2009 May 26 References: 04-007 NUMBER: TBD TITLE: Recursive constraint for specific calling same-named generic procedure KEYWORDS: recursive, generic procedures DEFECT TYPE: TBD STATUS: TDB QUESTION: Is the following code valid, where a specific function calls a same-named generic function, where the actual arguments are consistent with a different specific function? module mod_test implicit none type ta integer :: n end type ta interface f module procedure f0, f end interface contains pure function f0(n) result(y) integer, intent(in) :: n type(ta) :: y y%n = n end function f0 pure function f(p,q) result(y) integer, intent(in) :: p,q type(ta) :: y y = f(p+q) end function f end module mod_test Section 12.5.2.1 (Function subprogram, at lines 31-33 on page 296) states: "If RESULT is specified, [...] all occurrences of the function name in execution-part statements in the scoping unit refer to the function itself." And before (line 26): "The prefix-spec RECURSIVE shall appear if the function directly or indirectly invokes itself" Section 12.4.4 (Resolving named procedure references, at lines 25, 31-34 on page 276 and 3-4 on page 277): "(1) A procedure name is established to be generic in a scoping unit [...] (d) if that scoping unit contains no declarations of that name, that scoping unit has a host scoping unit, and that name is established to be generic in the host scoping unit. (2) A procedure name is established to be only specific in a scoping unit if it is established to be specific and not established to be generic. It is established to be specific [...] (e) if that scoping unit contains no declarations of that name, that scoping unit has a host scoping unit, and that name is established to be specific in the host scoping unit" Section 16.4.1.3 (Host association, on page 411), which lists reasons, why a host-associated entity becomes inaccessible by that name, none of which seem to apply. ANSWER: EDITS: SUBMITTED BY: Tobias Burnus