J3/15-120 To: J3 Subject: Wart removal proposal -- Forward type in TYPE type specifier From: Van Snyder Date: 2015 February 04 Reference: 15-007 1. Introduction =============== The description of the TYPE type specifier (4.3.2.2p2) requires (but does not constrain) that the specified derived type be defined previously or accessed by use or host association. It then goes on to make a long-winded exception, allowing forward reference from a FUNCTION statement. There is no exception for pointer or allocatable components, thereby contradicting C445, which also allows forward reference. If processors are required to handle a forward reference in these cases, it does not seem unreasonable to handle it in more general cases. The description of the CLASS type specifier (4.3.2.3) is entirely silent concerning forward reference to a type definition. One might argue that there is no problem with CLASS because polymorphic objects must be allocatable, a pointer, or a dummy argument. Therefore, the circular dependence among type definitions involving components that are not allocatable or pointers is impossible. Pursuing that argument, and the observation that processors already must handle forward type name references in at least two circumstances, one wonders why C445 is not enough for TYPE type specifiers. 2. Proposal =========== Allow a TYPE type specifier to reference a type that is not yet defined, except in the declaration of components that are not allocatable or pointers. 3. Draft Edits ============== [Introduction, under "Data usage and computation"] Insert list item "-- The derived type specified in a TYPE type specifier need not be previously defined, except in the declaration of components that are neither allocatable nor pointers. " [54:3-9 4.3.2.2p2] Delete the paragraph. {In light of C488, it's not necessary even to say in 4.3.2.2 or 4.3.2.3 that the derived type name shall be accessible.}