brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · d26d5c8 Raw
38 lines · plain
1! RUN: %python %S/test_errors.py %s %flang_fc12! Check for distinguishability of defined I/O procedures defined within3! and outside their types.4module m15  type t16    integer n7   contains8    procedure :: readt1a, readt1b9    !ERROR: Generic 'read(unformatted)' may not have specific procedures 'readt1a' and 'readt1b' as their interfaces are not distinguishable10    generic :: read(unformatted) => readt1a, readt1b11  end type12  type t213    integer n14  end type15  type t316    integer n17  end type18  !ERROR: Generic 'read(unformatted)' may not have specific procedures 'readt2a' and 'readt2b' as their interfaces are not distinguishable19  interface read(unformatted)20    module procedure :: readt1a, readt2a, readt2b, readt321  end interface22 contains23#define DEFINE_READU(name, type) \24  subroutine name(dtv, unit, iostat, iomsg); \25    class(type), intent(in out) :: dtv; \26    integer, intent(in) :: unit; \27    integer, intent(out) :: iostat; \28    character(*), intent(in out) :: iomsg; \29    read(unit, iostat=iostat, iomsg=iomsg) dtv%n; \30  end subroutine name31  !ERROR: Derived type 't1' has conflicting type-bound input/output procedure 'read(unformatted)'32  DEFINE_READU(readt1a, t1)33  DEFINE_READU(readt1b, t1)34  DEFINE_READU(readt2a, t2)35  DEFINE_READU(readt2b, t2)36  DEFINE_READU(readt3, t3)37end module38