pawn-lang / compiler

Pawn compiler for SA-MP with bug fixes and new features - runs on Windows, Linux, macOS
Other
307 stars 72 forks source link

Can't assign non-const in array initialization #469

Open AGraber opened 5 years ago

AGraber commented 5 years ago

Issue description:

For some reason, new array[2] = anotherArray; is wrong and gives an error: must be a constant expression; assumed zero. I have to then resort to this: new array[2]; array2 = anotherArray;. which achieves the desired result. Now, I understand this was made on purpose, but does it really need to be like that? This just complicates syntax for something that is valid in virtually any other language.

Minimal complete verifiable example (MCVE):

new anotherArray[2] = {1, 2};
main()
{
    new array[2] = anotherArray; // must be a constant expression; assumed zero
}
stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity.