Skip to content

Local constants don't go out of scope until the end of function #541

@Daniel-Cortez

Description

@Daniel-Cortez

Issue description:

main()
{
    {
        const CONSTVAL = 0;
    }
    return CONSTVAL;
}

For some reason this code compiles, although normally CONSTVAL should go out of scope at the end of local block, before return.

The same bug also applies to enumeration items:

main()
{
    {
        enum {
            ENUM_ITEM1 = 0
        };
    }
    return ENUM_ITEM1; // compiles without errors
}

Minimal complete verifiable example (MCVE):

See above.

Workspace Information:

  • Compiler version: 3.10.10, 3.2.3664
  • 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