To: J3 12-114r1 From: Malcolm Cohen/Robert Corbett Subject: passing arrays of extended type objects Date: 2012 February 14 ---------------------------------------------------------------------- NUMBER: F08/0067 TITLE: passing arrays of extended type objects KEYWORDS: assumed-size arrays, extended type DEFECT TYPE: Erratum STATUS: J3 consideration in progress QUESTION: Can an assumed-size array of extended type be passed as an actual argument to a nonpolymorphic dummy array whose type is the parent type of the extended type? Clause 6.5.2 "Whole arrays" [121:10-12] permits an assumed-size array to appear as an actual argument in a procedure reference. Consider the program MODULE TYPES TYPE REC INTEGER A END TYPE TYPE, EXTENDS(REC) :: REC2 INTEGER B END TYPE END SUBROUTINE SUB1(A, N) USE TYPES CLASS(REC), INTENT(IN) :: A(*) CALL SUB2(A, N) END SUBROUTINE SUB2(A, N) USE TYPES TYPE(REC) A(*) PRINT *, A(:N)%A END PROGRAM MAIN USE TYPES CLASS(REC), ALLOCATABLE :: A(:) INTERFACE SUBROUTINE SUB1(A, N) USE TYPES CLASS(REC), INTENT(IN) :: A(*) END SUBROUTINE END INTERFACE ALLOCATE (A, SOURCE = (/(REC2(I, -I), I = 1, 10)/)) CALL SUB1(A, 10) END The subroutine reference in SUB1 that invokes SUB2 appears to be standard conforming according to that clause. Is that intended? ANSWER: The invocation of SUB2 in SUB1 requires the shape, and therefore the example is not standard-conforming. An edit is supplied to clarify this. EDIT to 10-007r1: [293:5] In 12.5.2.4 Ordinary dummy variables, paragraph 2, append "If the actual argument is a polymorphic assumed-size array, the dummy argument shall be polymorphic." SUBMITTED BY: Robert Corbett HISTORY: 12-114 m197 Submitted 12-114r1 m197 Draft answer ----------------------------------------------------------------------