I would like to force inheriting classes to define a destructor in Fortran >= 2008.
So far I have tried several variations of:
type, abstract :: parent_class_t
contains
final, deferred, pass :: cleanup
end type
which don't even compile. How do I achieve that goal?
Final bindings are NOT inherited. Every type can declare its own. When a an child derived type is finalized, the parent finalization procedure is called automatically. Abstract types cannot have a final subroutine because it would not make sense.
The standard (2018 draft) contains this explanation note:
As francescalus notes, the syntax is:
R753 final-procedure-stmt is
FINAL[ :: ] final-subroutine-name-listno attributes may be specified.