2014-04-15 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gfortran.dg / constructor_3.f90
blobbadff3f6af5da37132bf4660d30ca33c93eca3d2
1 ! { dg-do run }
3 ! PR fortran/39427
5 ! Check constructor functionality.
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
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
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) call abort ()
42 if (k /= 42) call abort ()
43 !print *, x%j
44 !print *, k
45 end