J3/04-322r1 Date: 10th August 2004 To: J3 From: Malcolm Cohen Subject: Referencing deferred bindings The question has been revised to make it meaningful (it was missing the NOPASS attribute). If option 1 of the interp in 323r1 passes, tbis interp becomes subsumed. Otherwise, an edit is suggested. NUMBER: TITLE: Referencing deferred bindings KEYWORDS: Type-bound procedure, deferred binding DEFECT TYPE: STATUS: J3 consideration in progress QUESTION: I thought that the intent was that it would be impossible to reference a deferred binding. However, it doesn't appear to me that this intent was achieved. Consider the following program (Sorry, but I don't have any compilers up to syntax-checking this). program defer type, abstract :: t contains procedure (sub), nopass, deferred :: deferred_proc end type t type, extends(t) :: t2 contains procedure :: deferred_proc => sub2 end type t2 class(t), pointer :: x nullify(x) call x%deferred_proc contains subroutine sub write (*,*) 'Hello.' end subroutine sub subroutine sub2 write (*,*) 'Goodbye.' end subroutine sub2 end program defer Is this a valid program? If not, what restriction of the standard does it violate? Note that x%deferred_proc does not require the value of x (4.5.7) and thus is not a reference to x (2.5.6). Therefore, [83:23-24] does not prohibit this. Nor is it clear that there is an intent to prohibit invocation of type-bound procedures for disassociated pointer objects; except in the case of deferred bindings, this seems well-defined and potentially useful. Because x is disassociated, its dynamic type is the same as its declared type, thus making the interpretation of x%nondeferred_proc reasonably clear. ANSWER: No, this was not intended to be a valid program. An edit is supplied to clarify this situation. EDITS: [266:24+] Insert "C1224a (R1219) If is that of a deferred type-bound procedure, or is generically resolved to a specific deferred type-bound procedure, shall not be a disassociated pointer, an undefined pointer, or an unallocated allocatable variable." SUBMITTED BY: Richard Maine HISTORY: J3/04-322 m169 Submitted J3/04-322r1 m169 Revised