J3/05-224 Date: 22 July 2005 To: J3 From: Rob James Subject: Finalization of array constructors NUMBER: F03/0062 TITLE: Finalization of array constructors KEYWORDS: Finalization, array constructor DEFECT TYPE: Erratum STATUS: J3 consideration in progress QUESTION: Consider the following program: MODULE m TYPE t INTEGER i CONTAINS FINAL :: finalizeT END TYPE CONTAINS SUBROUTINE finalizeT(obj) TYPE(t) :: obj(:) PRINT *, 'Finalizing a rank-1 array of type t' END SUBROUTINE END MODULE PROGRAM foo USE m TYPE(t) :: a a%i = 5 PRINT *, (/ (a, i=1,5) /) END PROGRAM If the PRINT statement in the main program was printing a function result or a structure constructor, rather than an array constructor, it is clear that the object should be finalized after that PRINT statement. However, for array constructors, this does not appear to be the case. In the main program above, should the entity created by the array constructor be finalized after execution of the PRINT statement? ANSWER: Yes, the array constructor should be finalized. Edits are provided to correct this oversight. EDITS: This edit refers to 04-007. [59:27] Replace the first occurrence of "structure" with "structure or array". This edit refers to the edit introduced by interpretation F03/0007. Replace the first occurrence of "structure" with "structure or array". SUBMITTED BY: Rob James HISTORY: 05-177 m172 Submitted 05-224 m173 Edits revised