Skip to content

Commit 55c4d16

Browse files
committed
test
1 parent 8963056 commit 55c4d16

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// RUN: %check_clang_tidy %s performance-lost-std-move %t -- -config='{CheckOptions: {performance-lost-std-move.StrictMode: false}}'
2+
3+
namespace std {
4+
5+
template<typename T>
6+
class shared_ptr {
7+
public:
8+
T& operator*() { return reinterpret_cast<T&>(*this); }
9+
shared_ptr() {}
10+
shared_ptr(const shared_ptr<T>&) {}
11+
};
12+
13+
template<typename T>
14+
T&& move(T&)
15+
{
16+
}
17+
18+
} // namespace std
19+
20+
int f(std::shared_ptr<int>);
21+
22+
void f_copy_after_ref()
23+
{
24+
std::shared_ptr<int> ptr;
25+
auto& ref = ptr;
26+
f(ptr);
27+
// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: could be std::move() [performance-lost-std-move]
28+
// CHECK-FIXES: f(std::move(ptr));
29+
*ref = 1;
30+
}

0 commit comments

Comments
 (0)