Index: clang-tidy/modernize/MakeSmartPtrCheck.cpp =================================================================== --- clang-tidy/modernize/MakeSmartPtrCheck.cpp +++ clang-tidy/modernize/MakeSmartPtrCheck.cpp @@ -199,6 +199,13 @@ return; } + // There are some cases where we don't have operator ("." or "->") of the + // "reset" expression, e.g. call "reset()" method directly in the subclass of + // "std::unique_ptr<>". We skip these cases. + if (OperatorLoc.isInvalid()) { + return; + } + auto Diag = diag(ResetCallStart, "use %0 instead") << MakeSmartPtrFunctionName; Index: test/clang-tidy/modernize-make-unique.cpp =================================================================== --- test/clang-tidy/modernize-make-unique.cpp +++ test/clang-tidy/modernize-make-unique.cpp @@ -415,3 +415,16 @@ g2(t); } #undef DEFINE + +class UniqueFoo : public std::unique_ptr { + public: + void foo() { + reset(new Foo); + this->reset(new Foo); + // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: use std::make_unique instead + // CHECK-FIXES: *this = std::make_unique(); + (*this).reset(new Foo); + // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: use std::make_unique instead + // CHECK-FIXES: (*this) = std::make_unique(); + } +};