1 ! RUN: %S/test_errors.sh %s %t %flang_fc1
3 ! Test SELECT CASE Constraints: C1145, C1146, C1147, C1148, C1149
6 ! local variable declaration
7 character :: grade1
= 'B'
9 logical :: grade3
= .false
.
11 character (len
= 10) :: name
= 'test'
12 logical, parameter :: grade5
= .false
.
13 CHARACTER(KIND
=1), parameter :: ASCII_parm1
= 'a', ASCII_parm2
='b'
14 CHARACTER(KIND
=2), parameter :: UCS16_parm
= 'c'
15 CHARACTER(KIND
=4), parameter :: UCS32_parm
='d'
19 type (scores
) :: score
= scores(25)
20 type (scores
), parameter :: score_val
= scores(50)
49 !ERROR: SELECT CASE expression must be integer, logical, or character
57 !ERROR: SELECT CASE expression must be integer, logical, or character
67 !ERROR: CASE DEFAULT conflicts with previous cases
73 !ERROR: CASE value has type 'CHARACTER(1)' which is not compatible with the SELECT CASE expression's type 'INTEGER(4)'
79 !ERROR: CASE value has type 'INTEGER(4)' which is not compatible with the SELECT CASE expression's type 'CHARACTER(KIND=1,LEN=1_8)'
87 !ERROR: CASE value has type 'INTEGER(4)' which is not compatible with the SELECT CASE expression's type 'LOGICAL(4)'
94 !ERROR: CASE value has type 'LOGICAL(4)' which is not compatible with the SELECT CASE expression's type 'INTEGER(4)'
96 !ERROR: CASE value has type 'REAL(4)' which is not compatible with the SELECT CASE expression's type 'INTEGER(4)'
98 !ERROR: CASE value has type 'CHARACTER(1)' which is not compatible with the SELECT CASE expression's type 'INTEGER(4)'
102 select
case (ASCII_parm1
)
104 !ERROR: CASE value has type 'CHARACTER(4)' which is not compatible with the SELECT CASE expression's type 'CHARACTER(1)'
106 !ERROR: CASE value has type 'CHARACTER(2)' which is not compatible with the SELECT CASE expression's type 'CHARACTER(1)'
108 !ERROR: CASE value has type 'CHARACTER(4)' which is not compatible with the SELECT CASE expression's type 'CHARACTER(1)'
110 !ERROR: CASE value has type 'CHARACTER(2)' which is not compatible with the SELECT CASE expression's type 'CHARACTER(1)'
118 !ERROR: CASE range is not allowed for LOGICAL
126 !ERROR: CASE (.true._1) conflicts with previous cases
128 !ERROR: CASE (.false._1) conflicts with previous cases
133 case (51:50) ! warning
139 !ERROR: CASE (81_4:90_4) conflicts with previous cases
141 !ERROR: CASE (:80_4) conflicts with previous cases
143 !ERROR: CASE (200_4) conflicts with previous cases
151 !ERROR: CASE (:"hh") conflicts with previous cases
153 !ERROR: CASE (:"hd") conflicts with previous cases
157 !ERROR: CASE ("hj") conflicts with previous cases
159 !ERROR: CASE ("ha") conflicts with previous cases
161 !ERROR: CASE ("hz") conflicts with previous cases
170 !OK: these cases do not overlap
177 !ERROR: CASE (:0_4) conflicts with previous cases