1 ! RUN: %python %S/test_errors.py %s %flang_fc1
2 ! Test SELECT CASE Constraints: C1145, C1146, C1147, C1148, C1149
5 ! local variable declaration
6 character :: grade1
= 'B'
8 logical :: grade3
= .false
.
10 character (len
= 10) :: name
= 'test'
11 logical, parameter :: grade5
= .false
.
12 CHARACTER(KIND
=1), parameter :: ASCII_parm1
= 'a', ASCII_parm2
='b'
13 CHARACTER(KIND
=2), parameter :: UCS16_parm
= 'c'
14 CHARACTER(KIND
=4), parameter :: UCS32_parm
='d'
18 type (scores
) :: score
= scores(25)
19 type (scores
), parameter :: score_val
= scores(50)
48 !ERROR: SELECT CASE expression must be integer, logical, or character
56 !ERROR: SELECT CASE expression must be integer, logical, or character
66 !ERROR: CASE DEFAULT conflicts with previous cases
72 !ERROR: CASE value has type 'CHARACTER(1)' which is not compatible with the SELECT CASE expression's type 'INTEGER(4)'
78 !ERROR: CASE value has type 'INTEGER(4)' which is not compatible with the SELECT CASE expression's type 'CHARACTER(KIND=1,LEN=1_8)'
86 !ERROR: CASE value has type 'INTEGER(4)' which is not compatible with the SELECT CASE expression's type 'LOGICAL(4)'
93 !ERROR: CASE value has type 'LOGICAL(4)' which is not compatible with the SELECT CASE expression's type 'INTEGER(4)'
95 !ERROR: CASE value has type 'REAL(4)' which is not compatible with the SELECT CASE expression's type 'INTEGER(4)'
97 !ERROR: CASE value has type 'CHARACTER(1)' which is not compatible with the SELECT CASE expression's type 'INTEGER(4)'
101 select
case (ASCII_parm1
)
103 !ERROR: CASE value has type 'CHARACTER(4)' which is not compatible with the SELECT CASE expression's type 'CHARACTER(1)'
105 !ERROR: CASE value has type 'CHARACTER(2)' which is not compatible with the SELECT CASE expression's type 'CHARACTER(1)'
107 !ERROR: CASE value has type 'CHARACTER(4)' which is not compatible with the SELECT CASE expression's type 'CHARACTER(1)'
109 !ERROR: CASE value has type 'CHARACTER(2)' which is not compatible with the SELECT CASE expression's type 'CHARACTER(1)'
117 !ERROR: CASE range is not allowed for LOGICAL
125 !ERROR: CASE (.true._1) conflicts with previous cases
127 !ERROR: CASE (.false._1) conflicts with previous cases
132 case (51:50) ! warning
138 !ERROR: CASE (81_4:90_4) conflicts with previous cases
140 !ERROR: CASE (:80_4) conflicts with previous cases
142 !ERROR: CASE (200_4) conflicts with previous cases
150 !ERROR: CASE (:"hh") conflicts with previous cases
152 !ERROR: CASE (:"hd") conflicts with previous cases
156 !ERROR: CASE ("hj") conflicts with previous cases
158 !ERROR: CASE ("ha") conflicts with previous cases
160 !ERROR: CASE ("hz") conflicts with previous cases
169 !OK: these cases do not overlap
176 !ERROR: CASE (:0_4) conflicts with previous cases