-
Notifications
You must be signed in to change notification settings - Fork 246
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
…#1185) * Fixes #1168. ### Modification: - Suggested changes mentioned in #1168 were added in the `c2rust-transpile/src/translator/literals.rs` file - Added a relevant C program in `tests/enums/src/enum_compound.c` file - Modified `tests/enums/src/test_enums.rs` file to check the correct outputs ### Testing The added test case specifically checks for the correct assignment of enum values in buffer initialization using compound literals. This test has been integrated into the existing test suite and passed successfully, confirming the fix.
- Loading branch information
Showing
3 changed files
with
35 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
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,13 @@ | ||
|
||
typedef enum { | ||
B = 2 | ||
} a; | ||
|
||
void entry6(const unsigned buffer_size, int buffer[]) { | ||
if (buffer_size < 1) { | ||
return; | ||
} | ||
|
||
// Using a compound literal with enum to assign the value | ||
buffer[0] = (a) { B }; | ||
} |
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