Skip to content

Commit bfb5c39

Browse files
committed
KNOWNBUG test for enum-range check inside LHS of an assignment
85b90f3 has added a check that enum-typed expressions correspond to one of the enum constants. This adds a test that should fail an enum-range check inside the LHS of an assignment.
1 parent c4aaafd commit bfb5c39

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
typedef enum my_enum { A = 1, B = 2 };
2+
int my_array[10];
3+
4+
int main()
5+
{
6+
// should fail
7+
(enum my_enumt)3;
8+
9+
// should fail
10+
my_array[(enum my_enumt)4] = 10;
11+
12+
return 0;
13+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
KNOWNBUG
2+
enum_lhs.c
3+
--enum-range-check
4+
^\[main\.enum-range-check\.2\] line 10 enum range check in \(my_enumt\)4: FAILURE$
5+
^EXIT=10$
6+
^SIGNAL=0$
7+
--
8+
--
9+
The conversion to enum on the LHS should fail the enum-range check, but
10+
doesn't.
11+

0 commit comments

Comments
 (0)