08-240r2 To: J3 From: Van Snyder, originally from Michael Ingrassia Subject: Public Comment J32026 Date: 2008 August 14 ---------------------------------------------------------------------- Commenter: Robert Corbett Subject: "implicit typing should not be allowed in derived" Consider the program PROGRAM MAIN TYPE T INTEGER :: I = BIT_SIZE(J) END TYPE CALL SUBR1 CONTAINS SUBROUTINE SUBR1 J = 1 CALL SUBR2 PRINT *, J END SUBROUTINE SUBROUTINE SUBR2 J = 2 END SUBROUTINE END This program prints either 1 or 2 depending on the implementation with which it is compiled. Some implementations implicitly declared J in the top-level scope of the main program. Some declare J in the scope of the derived type definition, which is semantic nonsense, but there you have it. Paragraph 4 of Section 5.5 of the Fortran 2008 draft states The data entity is treated as if it were explicitly declared in the outermost scoping unit in which it appears. The derived type definition is the outermost scoping unit in which the occurrence of J in the derived type definition appears, but an explicit definition of J is not allowed in that context. The simple solution for this problem is to ban implicit typing in derived type definitions. ---------------------------------------------------------------------- J3 response: The same specification appears in the fourth paragraph of subclause 5.3 of the Fortran 2003 and Fortran 95 standards. This comment raises questions that deserve deeper consideration than J3 can give them at this time. J3 has internally generated an interpretation request.