brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.6 KiB · a00732a Raw
56 lines · plain
1! RUN: %python %S/test_errors.py %s %flang_fc12! Test visibility restrictions3module m4  type t15    integer, private :: ip1 = 1236   contains7    procedure :: fwrite18    generic :: write(formatted) => fwrite19  end type t110  type t211    integer, private :: ip2 = 23412    type(t1) x113  end type t214  type t315    type(t1) x116    type(t2) x217  end type t318  type, extends(t2) :: t419  end type t420 contains21  subroutine fwrite1(x, unit, iotype, vlist, iostat, iomsg)22    class(t1), intent(in) :: x23    integer, intent(in) :: unit24    character(*), intent(in) :: iotype25    integer, intent(in) :: vlist(:)26    integer, intent(out) :: iostat27    character(*), intent(in out) :: iomsg28    write(unit, *, iostat=iostat, iomsg=iomsg) '(', iotype, ':', vlist, ':', x%ip1, ')'29  end subroutine30  subroutine local ! all OK since type is local31    type(t1) :: x132    type(t2) :: x233    type(t3) :: x334    type(t4) :: x435    print *, x136    print *, x237    print *, x338    print *, x439  end subroutine40end module41 42program main43  use m44  type(t1) :: x145  type(t2) :: x246  type(t3) :: x347  type(t4) :: x448  print *, x1 ! ok49  !ERROR: I/O of the derived type 't2' may not be performed without defined I/O in a scope in which a direct component like 'ip2' is inaccessible50  print *, x251  !ERROR: I/O of the derived type 't3' may not be performed without defined I/O in a scope in which a direct component like 'ip2' is inaccessible52  print *, x353  !ERROR: I/O of the derived type 't4' may not be performed without defined I/O in a scope in which a direct component like 'ip2' is inaccessible54  print *, x455end56