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 check bugprone-copy-constructor-init gives no warning with the example in the docs #55572

Closed
sean-mcmanus opened this issue May 18, 2022 · 3 comments

Comments

@sean-mcmanus
Copy link

sean-mcmanus commented May 18, 2022

With clang-tidy 14.0.3 (on Windows 11).

Run clang-tidy with the example in the docs at https://releases.llvm.org/14.0.0/tools/clang/tools/extra/docs/clang-tidy/checks/bugprone-copy-constructor-init.html

Specifically,

class Copyable {
public:
  Copyable() = default;
  Copyable(const Copyable &) = default;
};
class X2 : public Copyable {
  X2(const X2 &other) {} // Copyable(other) is missing
};

with

clang-tidy.exe --config="{Checks: 'bugprone-copy-constructor-init'}" <path>/test.cpp -- -std=c++17

Bug: No warnings are reported. If I'm doing something wrong, maybe the docs could explain better what the requirements are.

@llvmbot
Copy link
Collaborator

llvmbot commented May 18, 2022

@llvm/issue-subscribers-clang-tidy

@PiotrZSL
Copy link
Member

Issue is not reported here, because check detect that base class has no members, and therefor it doesn't make any difference what constructor will be called. Only thing that should be done here, is documentation should be updated.

@PiotrZSL PiotrZSL self-assigned this Feb 22, 2023
@PiotrZSL PiotrZSL added the awaiting-review Has pending Phabricator review label Feb 22, 2023
@PiotrZSL
Copy link
Member

@github-actions github-actions bot removed the awaiting-review Has pending Phabricator review label Feb 26, 2023
CarlosAlbertoEnciso pushed a commit to SNSystems/llvm-debuginfo-analyzer that referenced this issue Feb 27, 2023
Correct example, and add information about limitations.

Fixes: llvm/llvm-project#55572

Reviewed By: carlosgalvezp

Differential Revision: https://reviews.llvm.org/D144594
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants