1! RUN: %python %S/test_errors.py %s %flang_fc1 2! Check for distinguishability of defined I/O procedures defined within 3! and outside their types. 4module m1 5 type t1 6 integer n 7 contains 8 procedure :: readt1a, readt1b 9 !ERROR: Generic 'read(unformatted)' may not have specific procedures 'readt1a' and 'readt1b' as their interfaces are not distinguishable 10 generic :: read(unformatted) => readt1a, readt1b 11 end type 12 type t2 13 integer n 14 end type 15 type t3 16 integer n 17 end type 18 !ERROR: Generic 'read(unformatted)' may not have specific procedures 'readt2a' and 'readt2b' as their interfaces are not distinguishable 19 interface read(unformatted) 20 module procedure :: readt1a, readt2a, readt2b, readt3 21 end interface 22 contains 23#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 name 31 !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 module 38