diff options
Diffstat (limited to 'clang-tools-extra/test/clang-tidy/readability-redundant-smartptr-get.cpp')
-rw-r--r-- | clang-tools-extra/test/clang-tidy/readability-redundant-smartptr-get.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/clang-tools-extra/test/clang-tidy/readability-redundant-smartptr-get.cpp b/clang-tools-extra/test/clang-tidy/readability-redundant-smartptr-get.cpp index 701b9defc40..61a36f6dee3 100644 --- a/clang-tools-extra/test/clang-tidy/readability-redundant-smartptr-get.cpp +++ b/clang-tools-extra/test/clang-tidy/readability-redundant-smartptr-get.cpp @@ -44,6 +44,14 @@ struct Fail2 { int& operator*(); }; +struct PointerWithOverloadedGet { + int* get(); + template <typename T> + T* get(); + int* operator->(); + int& operator*(); +}; + void Positive() { BarPtr u; // CHECK-FIXES: BarPtr u; @@ -100,6 +108,11 @@ void Positive() { // CHECK-MESSAGES: :[[@LINE-1]]:19: warning: redundant get() call // CHECK-MESSAGES: nullptr != ss->get(); // CHECK-FIXES: bb = nullptr != *ss; + + i = *PointerWithOverloadedGet().get(); + // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: redundant get() call + // CHECK-MESSAGES: i = *PointerWithOverloadedGet().get(); + // CHECK-FIXES: i = *PointerWithOverloadedGet(); } void Negative() { @@ -113,6 +126,8 @@ void Negative() { } }; + long l = *PointerWithOverloadedGet().get<long>(); + std::unique_ptr<Bar>* u; u->get()->Do(); |