To: J3 10-213 From: R. Bader Subject: public generic with same name as private type Date: 2010 September 27 Reference: N1814 NUMBER: F08/xxxx TITLE: public generic with same name as private type KEYWORDS: generic, accessibility DEFECT TYPE: Request for interpretation STATUS: J3 consideration in progress Consider the following code: module m implicit none private public :: foo type, private :: foo integer :: i = 0 end type type(foo), public :: o_foo interface foo module procedure foo_proc end interface contains function foo_proc(i) result(this) integer, intent(in) :: i type(foo) :: this this%i = i write(*, *) 'Hello' end function end module m program p use m implicit none o_foo = foo(2) end program QUESTION: Is this program standard conforming? DISCUSSION: R525 establishes that an accessibility statement may refer to a use-name or a generic-spec. It appears that the situation where use-name and generic-spec are identical, but are intended to have different accessibility, has not been dealt with. ANSWER 1: No, it was not intended that a generic with the same name as a derived type could have a different accessibility than that of the derived type. Therefore the above program is not standard conforming. ANSWER 2: Yes, the program is standard conforming. Since it is possible to define PUBLIC entities of PRIVATE type, it is desirable to be able to use a generic such as that defined in the example program, and the PUBLIC :: FOO statement refers to the generic procedure FOO. Unfortunately, it is not very clear to me how any of these answers should be described in the standard, since it appears (after a moderate amount of searching) that no provisions are in place which prevent an entity being equipped with contradicting accessibility attributes via an attribute and a statement, respectively. SUBMITTED BY: R. Bader HISTORY: Submitted September 27, 2010