Debian Codegraph @

gcc/testsuite/gfortran.dg/constructor_3.f90

raw
1 ! { dg-do run }
2 !
3 ! PR fortran/39427
4 !
5 ! Check constructor functionality.
6 !
7 !
8 module m
9 interface cons
10 procedure cons42
11 end interface cons
12 contains
13 integer function cons42()
14 cons42 = 42
15 end function cons42
16 end module m
17
18
19 module m2
20 type cons
21 integer :: j = -1
22 end type cons
23 interface cons
24 procedure consT
25 end interface cons
26 contains
27 type(cons) function consT(k)
28 integer :: k
29 consT%j = k**2
30 end function consT
31 end module m2
32
33
34 use m
35 use m2, only: cons
36 implicit none
37 type(cons) :: x
38 integer :: k
39 x = cons(3)
40 k = cons()
41 if (x%j /= 9) STOP 1
42 if (k /= 42) STOP 2
43 !print *, x%j
44 !print *, k
45 end