1 ! RUN: %python %S/test_errors.py %s %flang_fc1
2 ! Check errors in TRANSFER()
5 integer, intent(in
), optional
:: o
8 type(empty
) :: empty1(1)
10 real, allocatable
:: allocatable
12 type(hasdescriptor
) hasDesc
14 character(0) :: empty3(1)
15 integer, pointer :: source(:)
16 integer, allocatable
:: ia
17 integer, pointer :: ip
18 !ERROR: Element size of MOLD= array may not be zero when SOURCE= is not empty
19 print *, transfer(1., empty1
)
20 print *, transfer(1., empty2
) ! ok
21 !ERROR: Element size of MOLD= array may not be zero when SOURCE= is not empty
22 print *, transfer(1., empty3
)
23 !WARNING: Element size of MOLD= array may not be zero unless SOURCE= is empty
24 print *, transfer(source
, empty1
)
25 print *, transfer(source
, empty2
) ! ok
26 !WARNING: Element size of MOLD= array may not be zero unless SOURCE= is empty
27 print *, transfer(source
, empty3
)
28 !ERROR: SIZE= argument may not be the optional dummy argument 'o'
29 print *, transfer(1., empty2
, size
=o
)
30 !WARNING: SIZE= argument that is allocatable or pointer must be present at execution; parenthesize to silence this warning
31 print *, transfer(1., empty2
, size
=ia
)
32 !WARNING: SIZE= argument that is allocatable or pointer must be present at execution; parenthesize to silence this warning
33 print *, transfer(1., empty2
, size
=ip
)
34 !WARNING: Source of TRANSFER contains allocatable or pointer component %allocatable
35 print *, transfer(hasDesc
, 1)