08-270 To: J3 From: Van Snyder Subject: Interp: Equivalence of SEQUENCE derived types Date: 2008 August 14 References: 04-007 NUMBER: F03/0122 TITLE: When do objects of sequence derived type have the same type? KEYWORDS: SEQUENCE type DEFECT TYPE: Clarification STATUS: J3 consideration in progress QUESTION: Consider the following program: MODULE MOD TYPE, PRIVATE :: T SEQUENCE INTEGER :: I END TYPE TYPE(T) :: X, Y CONTAINS SUBROUTINE S X = Y END SUBROUTINE S END PROGRAM MAIN USE MOD CALL S X = Y END The first sentence of subclause 4.5.2.4 of the 2003 Fortran standard says the program conforms because the objects X and Y have the same type, because they are declared by reference to the same type definition. The last sentence of that subclause says they do not have the same type because the type definition is declared to be PRIVATE. Does the program conform to the 2003 Fortran standard? If not, which assignment statement causes the program not to conform? ANSWER: The program conforms to the 2003 Fortran standard. ANALYSIS: The determination that an object cannot have the same type as another one that is declared by reference to a type that is declared to be PRIVATE cannot possibly refer to an object declared in a scope where the type is not accessible. Therefore the objects must be declared in scopes where the type is accessible. It is irrelevant whether the type is "declared to be PRIVATE" in that scope, because accessibility attributes determine whether a name is accessible in a different scope. It would be absurd if the assignment statement in the module subprogram were not standard conforming. Given that it must be standard conforming, it would be absurd if the assignment statement in the main program were not standard conforming. Edits are provided to clarify this conclusion. EDITS: In subclause 4.5.2.4, remove "declared to be PRIVATE or" from the last sentence. SUBMITTED BY: Van Snyder HISTORY: 08-xxx m185 F03/0122 Submitted