Skip to content

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

@Daniel-Cortez

Description

@Daniel-Cortez

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:

  • Compiler version: 3.10.10
  • Command line arguments provided (or sampctl version):
  • Operating System:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions