2020-02-14 22:02:29 +08:00
|
|
|
! RUN: %S/test_modfile.sh %s %f18 %t
|
2018-09-01 07:20:00 +08:00
|
|
|
! Test writing procedure bindings in a derived type.
|
|
|
|
|
|
|
|
module m
|
|
|
|
interface
|
|
|
|
subroutine a(i, j)
|
|
|
|
integer :: i, j
|
|
|
|
end subroutine
|
|
|
|
end interface
|
|
|
|
type, abstract :: t
|
|
|
|
integer :: i
|
|
|
|
contains
|
|
|
|
procedure(a), deferred, nopass :: q
|
|
|
|
procedure(b), deferred, nopass :: p, r
|
|
|
|
end type
|
|
|
|
type t2
|
2018-09-06 23:01:49 +08:00
|
|
|
integer :: x
|
2018-09-01 07:20:00 +08:00
|
|
|
contains
|
2018-09-06 23:01:49 +08:00
|
|
|
private
|
2018-09-01 07:20:00 +08:00
|
|
|
final :: c
|
|
|
|
procedure, non_overridable :: d
|
2019-11-16 06:26:10 +08:00
|
|
|
end type
|
|
|
|
type, abstract :: t2a
|
|
|
|
contains
|
2018-09-06 23:01:49 +08:00
|
|
|
procedure(a), deferred, public, nopass :: e
|
|
|
|
end type
|
|
|
|
type t3
|
|
|
|
sequence
|
|
|
|
integer i
|
|
|
|
real x
|
2018-09-12 08:33:42 +08:00
|
|
|
double precision y
|
|
|
|
double complex z
|
2018-09-01 07:20:00 +08:00
|
|
|
end type
|
|
|
|
contains
|
|
|
|
subroutine b()
|
|
|
|
end subroutine
|
|
|
|
subroutine c(x)
|
|
|
|
type(t2) :: x
|
|
|
|
end subroutine
|
|
|
|
subroutine d(x)
|
|
|
|
class(t2) :: x
|
|
|
|
end subroutine
|
|
|
|
subroutine test
|
|
|
|
type(t2) :: x
|
|
|
|
call x%d()
|
|
|
|
end subroutine
|
|
|
|
end module
|
|
|
|
|
|
|
|
!Expect: m.mod
|
|
|
|
!module m
|
|
|
|
! interface
|
|
|
|
! subroutine a(i,j)
|
2018-09-12 08:33:42 +08:00
|
|
|
! integer(4)::i
|
|
|
|
! integer(4)::j
|
2018-09-01 07:20:00 +08:00
|
|
|
! end
|
|
|
|
! end interface
|
|
|
|
! type,abstract::t
|
2018-09-12 08:33:42 +08:00
|
|
|
! integer(4)::i
|
2018-09-01 07:20:00 +08:00
|
|
|
! contains
|
|
|
|
! procedure(a),deferred,nopass::q
|
|
|
|
! procedure(b),deferred,nopass::p
|
|
|
|
! procedure(b),deferred,nopass::r
|
|
|
|
! end type
|
|
|
|
! type::t2
|
2018-09-12 08:33:42 +08:00
|
|
|
! integer(4)::x
|
2018-09-01 07:20:00 +08:00
|
|
|
! contains
|
|
|
|
! final::c
|
2019-12-06 02:24:18 +08:00
|
|
|
! procedure,non_overridable,private::d
|
2019-11-16 06:26:10 +08:00
|
|
|
! end type
|
|
|
|
! type,abstract::t2a
|
|
|
|
! contains
|
2018-09-06 23:01:49 +08:00
|
|
|
! procedure(a),deferred,nopass::e
|
|
|
|
! end type
|
|
|
|
! type::t3
|
|
|
|
! sequence
|
2018-09-12 08:33:42 +08:00
|
|
|
! integer(4)::i
|
|
|
|
! real(4)::x
|
|
|
|
! real(8)::y
|
|
|
|
! complex(8)::z
|
2018-09-01 07:20:00 +08:00
|
|
|
! end type
|
|
|
|
!contains
|
|
|
|
! subroutine b()
|
|
|
|
! end
|
|
|
|
! subroutine c(x)
|
|
|
|
! type(t2)::x
|
|
|
|
! end
|
|
|
|
! subroutine d(x)
|
|
|
|
! class(t2)::x
|
|
|
|
! end
|
|
|
|
! subroutine test()
|
|
|
|
! end
|
|
|
|
!end
|