J3/01-160 Date: 05 March 2001 To: J3 From: Malcolm Cohen Subject: Revised Interp 00085 ---------------------------------------------------------------------- NUMBER: 000085 TITLE: Public components of private types KEYWORDS: Accessibility, Derived Types, Components DEFECT TYPE: Erratum STATUS: J3 consideration in progress QUESTION: F90 interpretation 32 indicated that components of a derived type may be accessible even in scopes where the derived type name is inaccessible. It added an edit to 12.1.2.2.1 of f90 (14.6.1.3 of f95) saying "If a derived type name of a host is inaccessible, data entities of that type or subobjects of such data entities can still be accessible." The discussions in the last 2 paragraphs of 4.4.1 of f95 appear to treat the accessibility of the derived type and its components as independent issues. Drafts of f2k added a note to make the independence clear. However, 14.1.2.5 of f95 says "If the type is accessible...and the definition of the type does not contain the PRIVATE statement (4.4.1), the component name is accessible...." This statement appears to make accessibility of the type a condition for accessibility of the component names, in contradiction with the above cited edit from f90 interpretation 32. The following code sample illustrates the issue. This sample works on several f90 compilers. module m type t integer :: i end type t type (t) :: a end module m program p use m, only: a a%i = 2 write (*,*) a%i end program p Question 1. Is it allowed to access public components of a derived type object when the type name is inaccessible as illustrated in the above sample code? Question 2. Should there be an edit in 14.1.2.5 of f95 to clarify this? ANSWER: (1) Yes. (2) Yes. DISCUSSION: The quoted text from 14.1.2.5 does not specify the accessibility of components when a type is not accessible. EDIT: [280:25-26] Replace "the type is accessible ... 14.6.1.3)" by "an entity of the type is accessible in another scoping unit" {Whether by use or host association, or - if the type is accessible - by declaring a local variable of the type.} SUBMITTED BY: Richard Maine HISTORY: 99-101 m148 Submitted WG5/N1404 Draft answer 00-260 m154 Passed by J3 meeting 00-329 m155 Failed J3 letter ballot 156-mjc-004 m156 Revised. ----------------------------------------------------------------------