function_types_2.f90

来自「用于进行gcc测试」· F90 代码 · 共 105 行

F90
105
字号
! { dg-do compile }! Tests the fix for PR34431 in which function TYPEs that were! USE associated would cause an error.!! Contributed by Tobias Burnus <burnus@gcc.gnu.org>!module m1  integer :: hh  type t    real :: r  end type tend module m1module m2  type t    integer :: k  end type tend module m2module m3contains  type(t) function func()    use m2    func%k = 77  end function funcend module m3type(t) function a()  use m1, only: hh  type t2    integer :: j  end type t2  type t    logical :: b  end type t  a%b = .true.end function atype(t) function b()  use m1, only: hh  use m2  use m3  b = func ()  b%k = 5end function btype(t) function c()  use m1, only: hh  type t2    integer :: j  end type t2  type t    logical :: b  end type t  c%b = .true.end function cprogram main  type t    integer :: m  end type tcontains  type(t) function a1()    use m1, only: hh    type t2      integer :: j    end type t2    type t      logical :: b    end type t    a1%b = .true.  end function a1  type(t) function b1()    use m1, only: hh    use m2, only: t! NAG f95 believes that the host-associated type(t)! should be used:!   b1%m = 5! However, I (Tobias Burnus) believe that the use-associated one should! be used:    b1%k = 5  end function b1  type(t) function c1()    use m1, only: hh    type t2      integer :: j    end type t2    type t      logical :: b    end type t    c1%b = .true.  end function c1  type(t) function d1()    d1%m = 55  end function d1end program main! { dg-final { cleanup-modules "m1 m2 m3" } }

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?