1 ! RUN: %python %S/test_errors.py %s %flang_fc1
9 !ERROR: Assignment to constant 'x%k' is not allowed
11 !ERROR: Assignment to constant 'x%l' is not allowed
17 !ERROR: A dummy argument may not also be a named constant
18 real, parameter :: x
= 0.0
19 real, parameter :: a(*) = [1, 2, 3]
20 character, parameter :: c(2) = "ab"
22 !ERROR: Assignment to constant 'x' is not allowed
25 !ERROR: Left-hand side of assignment is not modifiable
27 !ERROR: Left-hand side of assignment is not modifiable
29 !ERROR: Left-hand side of assignment is not modifiable
40 type(t
), parameter :: y
= t([1,2], 3)
43 !ERROR: Left-hand side of assignment is not modifiable
46 !ERROR: Assignment to constant 'y%b' is not allowed
57 type(t
), intent(in
) :: x
58 character(10), intent(in
) :: c
60 !ERROR: Left-hand side of assignment is not modifiable
62 !ERROR: Left-hand side of assignment is not modifiable
64 !ERROR: Left-hand side of assignment is not modifiable
77 type(t
), protected
:: b
83 !ERROR: Left-hand side of assignment is not modifiable
85 !ERROR: No explicit type declared for 'z'
87 !ERROR: Left-hand side of assignment is not modifiable
95 !ERROR: Assumed-size array 'x' must have explicit final subscript upper bound value
97 !ERROR: Whole assumed-size array 'x' may not appear here without subscripts
109 !ERROR: Whole assumed-size array 'x' may not appear here without subscripts
115 integer :: a(10), v(10)
116 a(v(:)) = 1 ! vector subscript is ok
120 !ERROR: Assignment to subprogram 's8' is not allowed
124 real function f9() result(r
)
125 !ERROR: Assignment to subprogram 'f9' is not allowed
129 !ERROR: No explicit type declared for dummy argument 'n'
133 a(1:n
) = 0.0 ! should not get a second error here
139 !ERROR: Function call must have argument list
141 !ERROR: Subroutine name is not allowed here
146 type dType(l1
, k1
, l2
, k2
)
154 subroutine sub(arg1
, arg2
, arg3
)
156 type(dType(arg1
, 2, *, 4)) :: arg2
157 type(dType(*, 2, arg1
, 4)) :: arg3
158 type(dType(1, 2, 3, 4)) :: local1
159 type(dType(1, 2, 3, 4)) :: local2
160 type(dType(1, 2, arg1
, 4)) :: local3
161 type(dType(9, 2, 3, 4)) :: local4
162 type(dType(1, 9, 3, 4)) :: local5
169 !ERROR: No intrinsic or user-defined ASSIGNMENT(=) matches operand types TYPE(dtype(k1=2_4,k2=4_4,l1=1_4,l2=3_4)) and TYPE(dtype(k1=2_4,k2=4_4,l1=9_4,l2=3_4))
170 local1
= local4
! mismatched constant KIND type parameter
171 !ERROR: No intrinsic or user-defined ASSIGNMENT(=) matches operand types TYPE(dtype(k1=2_4,k2=4_4,l1=1_4,l2=3_4)) and TYPE(dtype(k1=9_4,k2=4_4,l1=1_4,l2=3_4))
172 local1
= local5
! mismatched constant LEN type parameter
177 interface assignment(=)
178 procedure
:: cToR
, cToRa
, cToI
184 !ERROR: Defined assignment in WHERE must be elemental, but 'ctora' is not
186 where ([1==1]) n
='*' ! fine
189 !ERROR: Defined assignment in WHERE must be elemental, but 'ctor' is not
193 !ERROR: Defined assignment in WHERE must be elemental, but 'ctor' is not
197 !ERROR: Defined assignment in WHERE must be elemental, but 'ctor' is not
205 subroutine cToR(x
, c
)
206 real, intent(out
) :: x
207 character, intent(in
) :: c
209 subroutine cToRa(x
, c
)
210 real, intent(out
) :: x(:)
211 character, intent(in
) :: c
213 elemental
subroutine cToI(n
, c
)
214 integer, intent(out
) :: n
215 character, intent(in
) :: c