diff options
Diffstat (limited to 'test/clang-tidy/bugprone-use-after-move.cpp')
-rw-r--r-- | test/clang-tidy/bugprone-use-after-move.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/clang-tidy/bugprone-use-after-move.cpp b/test/clang-tidy/bugprone-use-after-move.cpp index 59dcb90c..dd37aec6 100644 --- a/test/clang-tidy/bugprone-use-after-move.cpp +++ b/test/clang-tidy/bugprone-use-after-move.cpp @@ -244,6 +244,19 @@ void standardSmartPtr() { std::move(ptr); ptr.get(); } + // Make sure we treat references to smart pointers correctly. + { + std::unique_ptr<A> ptr; + std::unique_ptr<A>& ref_to_ptr = ptr; + std::move(ref_to_ptr); + ref_to_ptr.get(); + } + { + std::unique_ptr<A> ptr; + std::unique_ptr<A>&& rvalue_ref_to_ptr = std::move(ptr); + std::move(rvalue_ref_to_ptr); + rvalue_ref_to_ptr.get(); + } // We don't give any special treatment to types that are called "unique_ptr" // or "shared_ptr" but are not in the "::std" namespace. { |