-
Notifications
You must be signed in to change notification settings - Fork 269
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
Showing
2 changed files
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
typedef enum my_enum | ||
{ | ||
A = 1, | ||
B = 2 | ||
}; | ||
int my_array[10]; | ||
|
||
int main() | ||
{ | ||
// should fail | ||
(enum my_enumt)3; | ||
|
||
// should fail | ||
my_array[(enum my_enumt)4] = 10; | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
KNOWNBUG | ||
enum_lhs.c | ||
--enum-range-check | ||
^\[main\.enum-range-check\.2\] line 10 enum range check in \(my_enumt\)4: FAILURE$ | ||
^EXIT=10$ | ||
^SIGNAL=0$ | ||
-- | ||
-- | ||
The conversion to enum on the LHS should fail the enum-range check, but | ||
doesn't. | ||
|