[PATCH] D33722: [clang-tidy] Add checker for undelegated copy of base classes
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 9 19:46:31 PST 2017
aaron.ballman added inline comments.
================
Comment at: clang-tidy/misc/CopyConstructorInitCheck.cpp:69
+ (Ctor->getAccess() == AS_private || Ctor->isDeleted())) {
+ NonCopyableBase = true;
+ break;
----------------
xazax.hun wrote:
> aaron.ballman wrote:
> > What if the base class is inherited privately? e.g.,
> > ```
> > struct Base {
> > Base(const Base&) {}
> > };
> >
> > struct Derived : private Base {
> > Derived(const Derived &) {}
> > };
> > ```
> We warn in that case too. I added a test to demonstrate this. I think we still want to copy private bases in copy ctors if they are not empty and copyable.
Good, thank you for adding the test (and I agree, we want to warn in that case).
https://reviews.llvm.org/D33722
More information about the cfe-commits
mailing list