Skip to content

COR071 missing-class-default ​

warning opt-in

A select type construct has no class default.

Why ​

A select type without class default silently skips every dynamic type it does not list: an extension added later, or an unexpected argument, is ignored instead of reported. Add class default with an error, unless ignoring the other types is the intent.

Reported ​

fortran
select type (q)
type is (real(R8P))
  call apply(q)
end select

Preferred ​

fortran
select type (q)
type is (real(R8P))
  call apply(q)
class default
  error stop 'unsupported type'
end select

Suppressing ​

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

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

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