Skip to content

Wrong source range for local/global declarations with unused/alias attribute. #140020

Open
@hokein

Description

@hokein

See https://godbolt.org/z/bG5cEzY4Y

struct TestType {
[[maybe_unused]] int unsafe_one[16]; // #1 good, it is fixed by https://github.com/llvm/llvm-project/commit/b3a6d434a7051d879718ef92a4fafd1697759aed
};

[[maybe_unused]] int unsafe_one[16]; // #2 bad

void func() {
[[maybe_unused]] int unsafe_one[16]; // #3 bad
}

The source range of the declaration should include the unused attribute.

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:frontendLanguage frontend issues, e.g. anything involving "Sema"confirmedVerified by a second party

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions