Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

misc-unused-using-decls incorrectly reports using as unused when it is used in elaborated-type-specifier #69714

Closed
ilya-biryukov opened this issue Oct 20, 2023 · 1 comment · Fixed by #70230
Assignees
Labels
clang-tidy false-positive Warning fires when it should not

Comments

@ilya-biryukov
Copy link
Contributor

namespace ns {
 struct Foo {};
}
using ns::Foo; // reported as unused
struct Foo * a; 

See https://gcc.godbolt.org/z/WM58br3q1.

It seems that Clang does not store enough information in the AST right now as information about usings gets lost when parsing declaration specifiers.

@llvmbot
Copy link
Collaborator

llvmbot commented Oct 20, 2023

@llvm/issue-subscribers-clang-tidy

Author: Ilya Biryukov (ilya-biryukov)

``` namespace ns { struct Foo {}; } using ns::Foo; // reported as unused struct Foo * a; ``` See https://gcc.godbolt.org/z/WM58br3q1.

It seems that Clang does not store enough information in the AST right now as information about usings gets lost when parsing declaration specifiers.

@EugeneZelenko EugeneZelenko added the false-positive Warning fires when it should not label Oct 20, 2023
@HerrCai0907 HerrCai0907 self-assigned this Oct 25, 2023
HerrCai0907 added a commit that referenced this issue Oct 26, 2023
…g in elaborated type (#70230)

`ElaboratedType` including tag keywords and any nested-name-specifiers.
We should ignore nested-name-specifiers case but consider tag keywords
case for `misc-unused-using-decls` check
Fixes: #69714
zahiraam pushed a commit to zahiraam/llvm-project that referenced this issue Oct 26, 2023
…g in elaborated type (llvm#70230)

`ElaboratedType` including tag keywords and any nested-name-specifiers.
We should ignore nested-name-specifiers case but consider tag keywords
case for `misc-unused-using-decls` check
Fixes: llvm#69714
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang-tidy false-positive Warning fires when it should not
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants