Index: clang-tools-extra/trunk/clang-tidy/modernize/MakeSmartPtrCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/modernize/MakeSmartPtrCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/modernize/MakeSmartPtrCheck.cpp @@ -86,7 +86,8 @@ cxxNewExpr(hasType(pointsTo(qualType(hasCanonicalType( equalsBoundNode(PointerType))))), CanCallCtor) - .bind(NewExpression))) + .bind(NewExpression)), + unless(isInTemplateInstantiation())) .bind(ConstructorCall)))), this); @@ -94,7 +95,8 @@ cxxMemberCallExpr( thisPointerType(getSmartPointerTypeMatcher()), callee(cxxMethodDecl(hasName("reset"))), - hasArgument(0, cxxNewExpr(CanCallCtor).bind(NewExpression))) + hasArgument(0, cxxNewExpr(CanCallCtor).bind(NewExpression)), + unless(isInTemplateInstantiation())) .bind(ResetCall), this); } Index: clang-tools-extra/trunk/test/clang-tidy/modernize-make-unique.cpp =================================================================== --- clang-tools-extra/trunk/test/clang-tidy/modernize-make-unique.cpp +++ clang-tools-extra/trunk/test/clang-tidy/modernize-make-unique.cpp @@ -451,3 +451,15 @@ // CHECK-FIXES: (*this) = std::make_unique(); } }; + +// Ignore statements inside a template instantiation. +template +void template_fun(T* t) { + std::unique_ptr t2 = std::unique_ptr(new T); + t2.reset(new T); +} + +void invoke_template() { + Foo* foo; + template_fun(foo); +}