J3/17-130 To: J3 Members From: Van Snyder Subject: Polymorphic allocatable ultimate component of function result Date: 2017 February 14 1. Discussion ============= C1583 prohibits invoking a pure function in a context that might result in executing an impure finalizer. This is not constraint-able if a function result has an allocatable polymorphic ultimate component, so is a clear error in the standard. C1584 prohibits a pure function from having a polymorphic allocatable result. C1586 prohibits an INTENT(OUT) dummy argument of a pure subroutine to be such that invoking the subroutine might result in executing an impure finalizer. C1587 prohibits an INTENT(OUT) argument of a pure subroutine to be polymorphic and allocatable, or to have a polymorphic allocatable ultimate component. C1583-C1584 are not completely parallel to C1586-C1587, in that C1587 prohibits a polymorphic allocatable ultimate component, and C1584 does not. Function results are very much like subroutines' INTENT(OUT) dummy arguments, so they ought to have similar requirements. To avoid the possibility of executing an impure finalizer as a consequence of a reference to a pure function, and to be parallel to C1587, C1584 also needs to prohibit a polymorphic allocatable ultimate component. This is a technical change from Fortran 2008. 2. Edits ======== [31:1+ 4.3.3 Fortran 2008 compatibility] Insert a paragraph: "Fortran 2008 permitted a pure function to have a result that has a polymorphic allocatable ultimate component; this document does not permit that." [336:25 C1584 15.7 Pure procedures] Replace whole constraint "A pure ... result" with "C1584 The function result of a pure function shall not be both polymorphic and allocatable, or have a polymorphic allocatable ultimate component." {Compare with C1583 and C1587.}