[clang-tidy] Supresses misc-move-constructor-init warning for const fields.
Patch by CJ DiMeglio! Differential revision: https://reviews.llvm.org/D28973 llvm-svn: 294459
This commit is contained in:
parent
2933875cc2
commit
bb64200e16
|
@ -57,6 +57,9 @@ void MoveConstructorInitCheck::check(const MatchFinder::MatchResult &Result) {
|
|||
if (QT.isTriviallyCopyableType(*Result.Context))
|
||||
return;
|
||||
|
||||
if (QT.isConstQualified())
|
||||
return;
|
||||
|
||||
const auto *RD = QT->getAsCXXRecordDecl();
|
||||
if (RD && RD->isTriviallyCopyable())
|
||||
return;
|
||||
|
|
|
@ -84,6 +84,16 @@ struct N {
|
|||
N(N &&RHS) : Mem(move(RHS.Mem)) {}
|
||||
};
|
||||
|
||||
struct O {
|
||||
O(O&& other) : b(other.b) {} // ok
|
||||
const B b;
|
||||
};
|
||||
|
||||
struct P {
|
||||
P(O&& other) : b(other.b) {} // ok
|
||||
B b;
|
||||
};
|
||||
|
||||
struct Movable {
|
||||
Movable(Movable &&) = default;
|
||||
Movable(const Movable &) = default;
|
||||
|
|
Loading…
Reference in New Issue