To: J3 J3/26-144r3 From: Brad Richardson & Generics Subject: Response to UTIs 018, 015 and 016 Date: 2026-June-18 Reference: 26-007r1 UTI 018 states: "Useless text left behind. I rewrote the above text because the paper was wrong, but in any case, I do not see anywhere it is useful." UTI 015 states: "Omitted weird and ineffectual constraints. Ctt43b is moot because you cannot instantiate a TEMPLATE construct until after it has been defined. That is what "previously defined" means. Ctt43c is ineffectual because local names identify local entities. Those may be use-associated with entities in templates, but anyway, they cannot even exist until the template has been instantiated. Ctt43b A template construct shall be ultimately defined prior to any entity that depends on it. Ctt43c A name that appears in a template shall not identify any entity that depends on that template." UTI 016 states: "Rules prohibit things already prohibited. TYPE(t) :: x is invalid unless TYPE t is previously defined. Which it is not. There may or may not be a hole somewhere here, but if so, this does not look like the way to fill it. An entity depends on an instantiation I if the entity's declaration or definition - contains the instantiation I - contains a name that identifies an entity from the instantiation I - contains a name that identifies an entity that depends on the instantiation I Ctt43d A name that appears as an instantiation argument shall not identify an entity that depends on that instantiation. NOTE 1 The following is an example that is invalid due to Ctt43b. template tmpl() type :: U type(T) :: x end type end template instantiate tmpl() type :: T type(U) :: x end type" ------- Subgroup concedes that the above constraints and examples could certainly be improved. However, we do believe that they address legitimate issues. Specifically, we don't think relying on "previously defined" sufficiently prevents all bad cases. In 20.5.1.4 Host association, "A derived-type definition, interface body, internal subprogram, module subprogram, or submodule has access to entities from its host as specified in 8.9. A host-associated variable is considered to have been previously declared; any other host-associated entity is considered to have been previously defined." Subgroup is concerned that there are problematic examples. In order to ensure that problematic examples are explicitly invalid, the following edits should be applied. [406:23-26] Delete the paragraph [407:] Delete the entirety of UTIs 018, 015, and 016. [407:] Insert new constraint C1624a, "Within a template, an entity accessed by host association shall not depend on any instantiation of the template." [407:] Insert the following as a note. "The following is an example that is invalid due to C1624a. TEMPLATE TMPL{} TYPE :: U TYPE(T) :: X END TYPE END TEMPLATE INSTANTIATE TMPL{} TYPE :: T TYPE(U) :: X END TYPE" [407:] Insert new constraint C1624b after the previous paragraph, "An instantiation argument shall not depend on that instantiation." [407:] Insert the following as a note. "The following is an example that is invalid due to C1624b. S1 has an argument of type T, which is created by the instantiation, thus S1 depends on the instantiation, and thus the instantiate statement violates the constraint. MODULE A TEMPLATE TMPL{S} TYPE :: T END TYPE DEFERRED INTERFACE SUBROUTINE S(X) TYPE(T) :: X END INTERFACE END INTERFACE END TEMPLATE INSTANTIATE TMPL{S1} CONTAINS SUBROUTINE S1(X) TYPE(T) :: X END SUBROUTINE END MODULE" [643:24] before "submodule" delete "or " and after "submodule" insert ", or template" such that the sentence now reads "A derived-type definition, interface body, internal subprogram, module subprogram, submodule, or template has access to entities from its host as specified in 8.9." --END--