-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Description
Compiler version: Pawn compiler 3.10.11 downloaded from open.mp v1.4.0.2779 server build
When initializing an array using a tagged enum size with the ellipsis (...) syntax, the array is not being properly initialized. Specifically, elements after the first one are set to 0 instead of being repeated as expected.
MVCE:
enum e_TEST_ENUM {
TEST_ITEM_1,
TEST_ITEM_2,
TEST_ITEM_3,
TEST_ITEM_4
};
new NotWorking[e_TEST_ENUM] = { 5, ... };
const TEST_ENUM_SIZE = _:e_TEST_ENUM;
new Working[e_TEST_ENUM:TEST_ENUM_SIZE] = { 5, ... };
#assert sizeof NotWorking == sizeof Working
main() {
for(new i = 0; i != sizeof NotWorking; ++ i) {
printf("%d, %d", NotWorking[e_TEST_ENUM:i], Working[e_TEST_ENUM:i]);
}
}Output:
5, 5
0, 5
0, 5
0, 5
Expected behavior:
5, 5
5, 5
5, 5
5, 5
Metadata
Metadata
Assignees
Labels
No labels