1 ! RUN: %S/test_modfile.sh %s %t %flang_fc1
6 procedure
, pass(x
) :: p1
=> f
7 procedure
, non_overridable
:: p2
=> f
8 procedure
, nopass
:: p3
=> f
9 generic
:: operator(+) => p1
10 generic
:: operator(-) => p2
11 generic
:: operator(<) => p1
12 generic
:: operator(.and
.) => p2
15 integer(8) pure
function f(x
, y
)
16 class(t1
), intent(in
) :: x
17 integer, intent(in
) :: y
19 ! Operators resolve to type-bound operators in t1
20 subroutine test1(x
, y
, a
, b
)
26 ! Operators resolve to type-bound operators in t1, compile-time resolvable
27 subroutine test2(x
, y
, a
, b
)
33 ! Operators resolve to type-bound operators in t1, compile-time resolvable
34 subroutine test3(x
, y
, a
)
44 ! procedure, pass(x) :: p1 => f
45 ! procedure, non_overridable :: p2 => f
46 ! procedure, nopass :: p3 => f
47 ! generic :: operator(+) => p1
48 ! generic :: operator(-) => p2
49 ! generic :: operator(<) => p1
50 ! generic :: operator(.and.) => p2
53 ! pure function f(x, y)
54 ! class(t1), intent(in) :: x
55 ! integer(4), intent(in) :: y
58 ! subroutine test1(x, y, a, b)
61 ! real(4) :: a(1_8:x%p1(y))
62 ! real(4) :: b(1_8:x%p1(y))
64 ! subroutine test2(x, y, a, b)
67 ! real(4) :: a(1_8:f(x, y))
68 ! real(4) :: b(1_8:f(x, y))
70 ! subroutine test3(x,y,a)
73 ! real(4) :: a(1_8:f(x,y))
80 procedure
, pass(x
) :: p1
=> f1
81 generic
:: operator(+) => p1
83 type, extends(t1
) :: t2
85 procedure
, pass(y
) :: p2
=> f2
86 generic
:: operator(+) => p2
89 integer(8) pure
function f1(x
, y
)
90 class(t1
), intent(in
) :: x
91 integer, intent(in
) :: y
93 integer(8) pure
function f2(x
, y
)
94 class(t1
), intent(in
) :: x
95 class(t2
), intent(in
) :: y
97 subroutine test1(x
, y
, a
)
102 ! Resolve to operator in parent class
103 subroutine test2(x
, y
, a
)
108 ! 2nd arg is passed object
109 subroutine test3(x
, y
, a
)
119 ! procedure, pass(x) :: p1 => f1
120 ! generic :: operator(+) => p1
122 ! type, extends(t1) :: t2
124 ! procedure, pass(y) :: p2 => f2
125 ! generic :: operator(+) => p2
128 ! pure function f1(x, y)
129 ! class(t1), intent(in) :: x
130 ! integer(4), intent(in) :: y
133 ! pure function f2(x, y)
134 ! class(t1), intent(in) :: x
135 ! class(t2), intent(in) :: y
138 ! subroutine test1(x, y, a)
141 ! real(4) :: a(1_8:x%p1(y))
143 ! subroutine test2(x, y, a)
146 ! real(4) :: a(1_8:x%p1(y))
148 ! subroutine test3(x, y, a)
151 ! real(4) :: a(1_8:y%p2(x))
158 procedure
, pass(x
) :: p1
=> f1
159 procedure
:: p3
=> f3
160 generic
:: operator(.binary
.) => p1
161 generic
:: operator(.unary
.) => p3
163 type, extends(t1
) :: t2
165 procedure
, pass(y
) :: p2
=> f2
166 generic
:: operator(.binary
.) => p2
169 integer(8) pure
function f1(x
, y
)
170 class(t1
), intent(in
) :: x
171 integer, intent(in
) :: y
173 integer(8) pure
function f2(x
, y
)
174 class(t1
), intent(in
) :: x
175 class(t2
), intent(in
) :: y
177 integer(8) pure
function f3(x
)
178 class(t1
), intent(in
) :: x
180 subroutine test1(x
, y
, a
)
183 real :: a(x
.binary
. y
)
185 ! Resolve to operator in parent class
186 subroutine test2(x
, y
, a
)
189 real :: a(x
.binary
. y
)
191 ! 2nd arg is passed object
192 subroutine test3(x
, y
, a
)
195 real :: a(x
.binary
. y
)
197 subroutine test4(x
, y
, a
)
200 real :: a(.unary
. x
+ .unary
. y
)
207 ! procedure,pass(x)::p1=>f1
209 ! generic::operator(.binary.)=>p1
210 ! generic::operator(.unary.)=>p3
212 ! type,extends(t1)::t2
214 ! procedure,pass(y)::p2=>f2
215 ! generic::operator(.binary.)=>p2
218 ! pure function f1(x,y)
219 ! class(t1),intent(in)::x
220 ! integer(4),intent(in)::y
223 ! pure function f2(x,y)
224 ! class(t1),intent(in)::x
225 ! class(t2),intent(in)::y
228 ! pure function f3(x)
229 ! class(t1),intent(in)::x
232 ! subroutine test1(x,y,a)
235 ! real(4)::a(1_8:x%p1(y))
237 ! subroutine test2(x,y,a)
240 ! real(4)::a(1_8:x%p1(y))
242 ! subroutine test3(x,y,a)
245 ! real(4)::a(1_8:y%p2(x))
247 ! subroutine test4(x,y,a)
250 ! real(4)::a(1_8:x%p3()+y%p3())