pawn-lang / compiler

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

Assertion failure when defining a static global variable with a name starting with `@` #623

Open Daniel-Cortez opened 3 years ago

Daniel-Cortez commented 3 years ago

Issue description:

Compiling the following code:

static @var = 0;

causes an assertion failure when the compiler is built with assertions enabled:

Assertion failed: !fstatic, file source\compiler\sc1.c, line 2085

It seems that function declglb() doesn't properly check if a variable is defined with a static specifier, and only has an assertion for this. Normally the compiler should issue error 042: invalid combination of class specifiers in such cases, as names starting with @ imply public.

Minimal complete verifiable example (MCVE):

See above.

Workspace Information:

stale[bot] commented 3 years ago

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