J3/17-126 To: J3 From: Malcolm Cohen Subject: Intrinsic and nonintrinsic modules Date: 2017 February 09 1. Introduction In subclause 14.2.2 The USE statement and use association, the following constraint appears "C1406 (R1409) A scoping unit shall not access an intrinsic module and a nonintrinsic module of the same name." This is obviously wrong, since a USE statement does not access a module, it references it. Also, it does not state that it does not include indirect references. A USE statement references a specific module, so in the absence of a specification to the contrary, this does in fact mean direct references only. Maybe no-one is confused about this? This text should be clarified. 2. Examples MODULE ISO_FORTRAN_ENV CHARACTER(*),PARAMETER :: MY_NAME = 'Fred Nurke' END MODULE MODULE MOD2 USE,NON_INTRINSIC :: ISO_FORTRAN_ENV END MODULE PROGRAM TEST USE MOD2 USE,INTRINSIC :: ISO_FORTRAN_ENV,ONLY:OUTPUT_UNIT IMPLICIT NONE WRITE(OUTPUT_UNIT,*) MY_NAME END PROGRAM At least one compiler objects to this example, spuriously claiming that it violates the aforementioned constraint. (Though slight variations of the example work without complaint!) Of course that might be a simple bug and not a misunderstanding... 3. Edits to 17-007 [297:16] 14.2.2 The USE statement and use association, C1406, After "A scoping unit shall not" change "access" to "reference", making the whole constraint read "C1406 (R1409) A scoping unit shall not reference an intrinsic module and a nonintrinsic module of the same name." {Fix the verb.} ALTERNATIVE: As above, but change "access" to "directly reference" instead. {I don't think this is really needed, but might be safer.} ===END===