annotate gcc/testsuite/gfortran.dg/constructor_1.f90 @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 ! { dg-do compile }
kono
parents:
diff changeset
2 !
kono
parents:
diff changeset
3 ! PR fortran/39427
kono
parents:
diff changeset
4 !
kono
parents:
diff changeset
5 ! Check constructor functionality.
kono
parents:
diff changeset
6 !
kono
parents:
diff changeset
7 ! Contributed by Damian Rouson.
kono
parents:
diff changeset
8 !
kono
parents:
diff changeset
9 module mycomplex_module
kono
parents:
diff changeset
10 private
kono
parents:
diff changeset
11 public :: mycomplex
kono
parents:
diff changeset
12 type mycomplex
kono
parents:
diff changeset
13 ! private
kono
parents:
diff changeset
14 real :: argument, modulus
kono
parents:
diff changeset
15 end type
kono
parents:
diff changeset
16 interface mycomplex
kono
parents:
diff changeset
17 module procedure complex_to_mycomplex, two_reals_to_mycomplex
kono
parents:
diff changeset
18 end interface
kono
parents:
diff changeset
19 ! :
kono
parents:
diff changeset
20 contains
kono
parents:
diff changeset
21 type(mycomplex) function complex_to_mycomplex(c)
kono
parents:
diff changeset
22 complex, intent(in) :: c
kono
parents:
diff changeset
23 ! :
kono
parents:
diff changeset
24 end function complex_to_mycomplex
kono
parents:
diff changeset
25 type(mycomplex) function two_reals_to_mycomplex(x,y)
kono
parents:
diff changeset
26 real, intent(in) :: x
kono
parents:
diff changeset
27 real, intent(in), optional :: y
kono
parents:
diff changeset
28 ! :
kono
parents:
diff changeset
29 end function two_reals_to_mycomplex
kono
parents:
diff changeset
30 ! :
kono
parents:
diff changeset
31 end module mycomplex_module
kono
parents:
diff changeset
32 ! :
kono
parents:
diff changeset
33 program myuse
kono
parents:
diff changeset
34 use mycomplex_module
kono
parents:
diff changeset
35 type(mycomplex) :: a, b, c
kono
parents:
diff changeset
36 ! :
kono
parents:
diff changeset
37 a = mycomplex(argument=5.6, modulus=1.0) ! The structure constructor
kono
parents:
diff changeset
38 c = mycomplex(x=0.0, y=1.0) ! A function reference
kono
parents:
diff changeset
39 c = mycomplex(0.0, 1.0) ! A function reference
kono
parents:
diff changeset
40 end program myuse