[flang] Accept polymorphic component element in storage_size
[llvm-project.git] / flang / test / Semantics / resolve37.f90
blobf8229f1f974a4c9e450c9a58bd23f4cba8199df3
1 ! RUN: %python %S/test_errors.py %s %flang_fc1
2 ! C701 The type-param-value for a kind type parameter shall be a constant
3 ! expression. This constraint looks like a mistake in the standard.
4 integer, parameter :: k = 8
5 real, parameter :: l = 8.0
6 integer :: n = 2
7 !ERROR: Must be a constant value
8 parameter(m=n)
9 integer(k) :: x
10 ! C713 A scalar-int-constant-name shall be a named constant of type integer.
11 !ERROR: Must have INTEGER type, but is REAL(4)
12 integer(l) :: y
13 !ERROR: Must be a constant value
14 integer(n) :: z
15 type t(k)
16 integer, kind :: k
17 end type
18 !ERROR: Type parameter 'k' lacks a value and has no default
19 type(t( &
20 !ERROR: Must have INTEGER type, but is LOGICAL(4)
21 .true.)) :: w
22 !ERROR: Must have INTEGER type, but is REAL(4)
23 real :: u(l*2)
24 !ERROR: Must have INTEGER type, but is REAL(4)
25 character(len=l) :: v
26 !ERROR: Value of named constant 'o' (o) cannot be computed as a constant value
27 real, parameter :: o = o
28 !WARNING: INTEGER(4) division by zero
29 !ERROR: Must be a constant value
30 integer, parameter :: p = 0/0
31 !WARNING: INTEGER(4) division by zero
32 !ERROR: Must be a constant value
33 !WARNING: INTEGER(4) division by zero
34 !WARNING: INTEGER(4) division by zero
35 !WARNING: INTEGER(4) division by zero
36 integer, parameter :: q = 1+2*(1/0)
37 integer not_constant
38 !ERROR: Must be a constant value
39 integer, parameter :: s1 = not_constant/2
40 !ERROR: Must be a constant value
41 integer, parameter :: s2 = 3/not_constant
42 !WARNING: INTEGER(4) division by zero
43 !ERROR: Must be a constant value
44 integer(kind=2/0) r
45 integer, parameter :: sok(*)=[1,2]/[1,2]
46 !WARNING: INTEGER(4) division by zero
47 !ERROR: Must be a constant value
48 integer, parameter :: snok(*)=[1,2]/[1,0]
49 end