J3/16-229 To: J3 From: Malcolm Cohen Subject: Clarify type-bound procedure duplication Date: 2016 June 08 Reference: 16-171r1 1. Introduction The standard does not clearly prohibit duplicate type-bound procedure definition. This should be clarified. 2. Specific type-bound procedures Consider TYPE T CONTAINS PROCEDURE :: P => MP ! (a) PROCEDURE :: P => MP ! (b) END TYPE The type-bound procedure declaration at (a) declares that P is a type-bound procedure in the scope of T. This fact is an "attribute" that determines the uses of P. Accordingly,C514 "An entity shall not be explicitly given any attribute more than once in a scoping unit." means that the duplicate declaration at (b) is invalid. However, this is far from obvious, so an explicit constraint should be added. 3. Generic type-bound procedures Consider TYPE T CONTAINS PROCEDURE :: P GENERIC :: G=>P, G=>P END TYPE This cannot be valid, as "A GENERIC statement declares a generic type-bound procedure, which is a type-bound generic interface for its specific type-bound procedures." but the list of its type-bound procedures has P occurring twice, and P cannot be distinguished from itself, so the list cannot satisfy the requirements for generic interfaces. Again, this is far from obvious and should be clarified. 4. EDITS to 16-007r1: [75:16+] 4.5.5 Type-bound procedures, after C470 insert new constraint: "C470a A in a in a derived type definition shall not be the same as any other within that derived type definition.". {Clearly prohibit duplicative specific tbp declaration.} [75:23+] same subclause, after "C472 (R451) Each ...type." insert new constraint "C472a A in a type-bound GENERIC statement shall not specify a specific binding that was inherited or specified previously for the same generic identifier in that derived type definition.". {Clearly prohibit duplicative generic tbp declaration.} ===END===