Skip to content

Commit 4f7115a

Browse files
committed
s
1 parent d126b72 commit 4f7115a

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

lib/valueflow.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8014,7 +8014,7 @@ static void valueFlowUninit(TokenList& tokenlist, const Settings* settings)
80148014
continue;
80158015
}
80168016
MemberExpressionAnalyzer analyzer(memVar.nameToken()->str(), tok, uninitValue, tokenlist, settings);
8017-
valueFlowGenericForward(start, tok->scope()->bodyEnd, std::move(analyzer), *settings);
8017+
valueFlowGenericForward(start, tok->scope()->bodyEnd, analyzer, *settings);
80188018

80198019
for (auto&& p : *analyzer.partialReads) {
80208020
Token* tok2 = p.first;

lib/valueptr.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ class CPPCHECKLIB ValuePtr {
3232
static T* apply(const T* x) {
3333
return new U(*static_cast<const U*>(x));
3434
}
35+
static T* move(T* x) {
36+
return new U(std::move(*static_cast<const U*>(x)));
37+
}
3538
};
3639

3740
public:
@@ -47,6 +50,10 @@ class CPPCHECKLIB ValuePtr {
4750
ValuePtr(const U& value) : mPtr(cloner<U>::apply(&value)), mClone(&cloner<U>::apply)
4851
{}
4952

53+
template<class U>
54+
ValuePtr(U&& value) : mPtr(cloner<U>::move(&value)), mClone(&cloner<U>::apply)
55+
{}
56+
5057
ValuePtr(const ValuePtr& rhs) : mPtr(nullptr), mClone(rhs.mClone) {
5158
if (rhs) {
5259
mPtr.reset(mClone(rhs.get()));

0 commit comments

Comments
 (0)