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

[clang-tidy] False positive cppcoreguidelines-rvalue-reference-param-not-moved when constructor is deleted #69412

Closed
ChrisThrasher opened this issue Oct 18, 2023 · 0 comments · Fixed by #69514
Assignees
Labels
clang-tidy false-positive Warning fires when it should not

Comments

@ChrisThrasher
Copy link

ChrisThrasher commented Oct 18, 2023

https://godbolt.org/z/dnE37P4c4

struct S
{
    S(const int&);
    S(int&&) = delete;
};

SFML uses this pattern where const& overloads are kept while && overloads are deleted to prevent constructor from temporary values. The && overloads get flagged by cppcoreguidelines-rvalue-reference-param-not-moved in spite of them being deleted and thus having no function body.

@ChrisThrasher ChrisThrasher changed the title [clang-tidy [clang-tidy] False positive cppcoreguidelines-rvalue-reference-param-not-moved when function is deleted Oct 18, 2023
@ChrisThrasher ChrisThrasher changed the title [clang-tidy] False positive cppcoreguidelines-rvalue-reference-param-not-moved when function is deleted [clang-tidy] False positive cppcoreguidelines-rvalue-reference-param-not-moved when constructor is deleted Oct 18, 2023
@EugeneZelenko EugeneZelenko added the false-positive Warning fires when it should not label Oct 18, 2023
@PiotrZSL PiotrZSL self-assigned this Oct 18, 2023
PiotrZSL added a commit that referenced this issue Oct 25, 2023
…erence-param-not-moved (#69514)

Ignore functions and constructors that are maked deleted or defaulted in
cppcoreguidelines-rvalue-reference-param-not-moved check.

Fixes #69412
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment