Skip to content

COR002 interface-implicit-typing ​

warning enabled by default

An interface body has no implicit none.

Why ​

An interface body is a separate scoping unit: it does not inherit the implicit none of the module or procedure that contains the interface block. Dummy arguments left undeclared in the body are typed implicitly, and the interface then disagrees with the procedure it describes.

Reported ​

fortran
interface
  subroutine callback(x)
    real :: x
  end subroutine callback
end interface

Preferred ​

fortran
interface
  subroutine callback(x)
    implicit none
    real, intent(inout) :: x
  end subroutine callback
end interface

Suppressing ​

For one occurrence, with the reason on the same line (or alone on the line before the statement):

fortran
! fobis: ignore[COR002] <why this occurrence is fine>

For the whole project, ignore = COR002 in the fobos [lint] section.

References ​

Sections of the shipped knowledge packs behind this rule:

  • fortran-std:ch19-scope-association#anti-patterns (fobis kb show fortran-std:ch19-scope-association#anti-patterns)

Equivalent ​

Fortitude rule C002 (see Lint Rules).