08-240 To: J3 From: Michael Ingrassia Subject: Public Comment J32026 Date: 2008 July 08 ---------------------------------------------------------------------- Commenter's Subject was "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. ----------------------------------------------------------------------