Skip to content

-Wshadow does not warn for static variables #62850

@alexkaratarakis

Description

@alexkaratarakis

Min repro:

// Compile with -Wshadow
int main()
{
    static bool CONDITION = false;

    {
        static bool CONDITION = true;
    }
}

expected results: declaration of 'CONDITION' shadows a previous local [-Wshadow]
actual results: No warnings

gcc warns when the diagnostic is enabled, but clang does not.

Demo: https://godbolt.org/z/WjPTMvYP8

Metadata

Metadata

Assignees

Labels

clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerconfirmedVerified by a second party

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions