1 ! RUN: %python %S/test_errors.py %s %flang_fc1
2 ! Test that user-defined assignment is used in the right places
9 interface assignment(=)
10 subroutine assign_il(x
, y
)
11 integer, intent(out
) :: x
12 logical, intent(in
) :: y
14 subroutine assign_li(x
, y
)
15 logical, intent(out
) :: x
16 integer, intent(in
) :: y
18 subroutine assign_tt(x
, y
)
20 type(t1
), intent(out
) :: x
21 type(t1
), intent(in
) :: y
23 subroutine assign_tz(x
, y
)
25 type(t1
), intent(out
) :: x
26 complex, intent(in
) :: y
28 subroutine assign_01(x
, y
)
29 real, intent(out
) :: x
30 real, intent(in
) :: y(:)
34 ! These are all intrinsic assignments
35 pure
subroutine test1()
36 type(t2
) :: a
, b
, b5(5)
46 ! These have invalid type combinations
51 complex :: z
, z5(5), z55(5,5)
52 !ERROR: No intrinsic or user-defined ASSIGNMENT(=) matches operand types TYPE(t1) and TYPE(t2)
54 !ERROR: No intrinsic or user-defined ASSIGNMENT(=) matches operand types REAL(4) and LOGICAL(4)
56 !ERROR: No intrinsic or user-defined ASSIGNMENT(=) matches operand types LOGICAL(4) and REAL(4)
58 !ERROR: No intrinsic or user-defined ASSIGNMENT(=) matches operand types TYPE(t1) and REAL(4)
60 !ERROR: No intrinsic or user-defined ASSIGNMENT(=) matches operand types TYPE(t2) and COMPLEX(4)
62 !ERROR: No intrinsic or user-defined ASSIGNMENT(=) matches scalar COMPLEX(4) and rank 1 array of COMPLEX(4)
64 !ERROR: No intrinsic or user-defined ASSIGNMENT(=) matches rank 1 array of LOGICAL(4) and scalar COMPLEX(4)
66 !ERROR: No intrinsic or user-defined ASSIGNMENT(=) matches rank 1 array of COMPLEX(4) and rank 2 array of COMPLEX(4)
70 ! These should all be defined assignments. Because the subroutines
71 ! implementing them are not pure, they should all produce errors
72 pure
subroutine test3()
78 !ERROR: Procedure 'assign_tt' referenced in pure subprogram 'test3' must be pure too
80 !ERROR: Procedure 'assign_il' referenced in pure subprogram 'test3' must be pure too
82 !ERROR: Procedure 'assign_li' referenced in pure subprogram 'test3' must be pure too
84 !ERROR: Procedure 'assign_il' referenced in pure subprogram 'test3' must be pure too
86 !ERROR: Procedure 'assign_tz' referenced in pure subprogram 'test3' must be pure too
88 !ERROR: Procedure 'assign_01' referenced in pure subprogram 'test3' must be pure too
92 ! Like test3 but not in a pure subroutine so no errors.