1 ! RUN: %S/test_errors.sh %s %t %flang_fc1
3 ! Test various conditions in C1158.
10 type, extends(t1
) :: t2
16 class(*), pointer :: ptr
17 class(t1
), pointer :: p_or_c
18 !vector subscript related
19 class(t1
),DIMENSION(:,:),allocatable
::array1
20 class(t2
),DIMENSION(:,:),allocatable
::array2
21 integer, dimension(2) :: V
26 ! A) associate with function, i.e (other than variables)
27 select
type ( y
=> fun(1) )
32 select
type ( y
=> fun(1) )
34 !ERROR: Left-hand side of assignment is not modifiable
37 !ERROR: Actual argument associated with INTENT(IN OUT) dummy argument 'z=' must be definable
38 call sub_with_in_and_inout_param(y
,y
) !VDC
41 ! B) associated with a variable:
43 select
type ( a
=> p_or_c
)
48 select
type ( a
=> p_or_c
)
52 !C)Associate with with vector subscript
53 select
type (b
=> array1(V
,2))
55 !ERROR: Left-hand side of assignment is not modifiable
58 !ERROR: Actual argument associated with INTENT(IN OUT) dummy argument 'z=' must be definable
59 call sub_with_in_and_inout_param_vector(b
,b
) !VDC
61 select
type(b
=> foo(1) )
63 !ERROR: Left-hand side of assignment is not modifiable
66 !ERROR: Actual argument associated with INTENT(IN OUT) dummy argument 'z=' must be definable
67 call sub_with_in_and_inout_param_vector(b
,b
) !VDC
70 !D) Have no association and should be ok.
71 !1. points to function
78 !2. points to variable
88 class(t1
),pointer :: fun
101 class(t1
),DIMENSION(:),allocatable
:: foo
102 integer, dimension(2) :: U
107 !ERROR: No intrinsic or user-defined ASSIGNMENT(=) matches operand types TYPE(t1) and TYPE(t2)
112 subroutine sub_with_in_and_inout_param(y
, z
)
113 type(t2
), INTENT(IN
) :: y
114 class(t2
), INTENT(INOUT
) :: z
118 subroutine sub_with_in_and_inout_param_vector(y
, z
)
119 type(t2
),DIMENSION(:), INTENT(IN
) :: y
120 class(t2
),DIMENSION(:), INTENT(INOUT
) :: z