https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78661
--- Comment #5 from janus at gcc dot gnu.org --- Btw, this variant is wrongly rejected: MODULE m IMPLICIT NONE TYPE :: t CHARACTER :: c CONTAINS PROCEDURE :: write_formatted GENERIC :: WRITE(FORMATTED) => write_formatted END TYPE CONTAINS SUBROUTINE write_formatted(dtv, unit, iotype, v_list, iostat, iomsg) CLASS(t), INTENT(IN) :: dtv INTEGER, INTENT(IN) :: unit CHARACTER(*), INTENT(IN) :: iotype INTEGER, INTENT(IN) :: v_list(:) INTEGER, INTENT(OUT) :: iostat CHARACTER(*), INTENT(INOUT) :: iomsg WRITE (unit, "(A)", IOSTAT=iostat, IOMSG=iomsg) dtv%c END SUBROUTINE END MODULE PROGRAM p USE m IMPLICIT NONE Class(t), allocatable :: x NAMELIST /nml/ x x = t('a') WRITE (*, nml) END NAMELIST /nml/ x 1 Error: NAMELIST object ‘x’ in namelist ‘nml’ at (1) is polymorphic and requires a defined input/output procedure