view gcc/testsuite/gfortran.dg/constructor_3.f90 @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 84e7813d76e9
children
line wrap: on
line source

! { dg-do run }
!
! PR fortran/39427
!
! Check constructor functionality.
!
!
module m
  interface cons
    procedure cons42
  end interface cons
contains
  integer function cons42()
    cons42 = 42
  end function cons42
end module m


module m2
  type cons
    integer :: j = -1
  end type cons
  interface cons
    procedure consT
  end interface cons
contains
  type(cons) function consT(k)
    integer :: k
    consT%j = k**2
  end function consT
end module m2


use m
use m2, only: cons
implicit none
type(cons) :: x
integer :: k
x = cons(3)
k = cons()
if (x%j /= 9) STOP 1
if (k /= 42) STOP 2
!print *, x%j
!print *, k
end