Index: clang-tidy/modernize/LoopConvertCheck.cpp =================================================================== --- clang-tidy/modernize/LoopConvertCheck.cpp +++ clang-tidy/modernize/LoopConvertCheck.cpp @@ -70,6 +70,7 @@ expr(hasType(isInteger())).bind(ConditionBoundName); return forStmt( + unless(isInTemplateInstantiation()), hasLoopInit(declStmt(hasSingleDecl(InitToZeroMatcher))), hasCondition(anyOf( binaryOperator(hasOperatorName("<"), @@ -159,6 +160,7 @@ .bind(DerefByRefResultName))))))); return forStmt( + unless(isInTemplateInstantiation()), hasLoopInit(anyOf(declStmt(declCountIs(2), containsDeclaration(0, InitDeclMatcher), containsDeclaration(1, EndDeclMatcher)), @@ -258,6 +260,7 @@ EndInitMatcher)); return forStmt( + unless(isInTemplateInstantiation()), hasLoopInit( anyOf(declStmt(declCountIs(2), containsDeclaration(0, InitToZeroMatcher), Index: test/clang-tidy/modernize-loop-convert-extra.cpp =================================================================== --- test/clang-tidy/modernize-loop-convert-extra.cpp +++ test/clang-tidy/modernize-loop-convert-extra.cpp @@ -626,3 +626,19 @@ } } // namespace Macros + +namespace Templates { + +template +void set_union(Container &container) { + for (typename Container::const_iterator SI = container.begin(), + SE = container.end(); SI != SE; ++SI) { + } +} + +void template_instantiation() { + S a; + set_union(a); +} + +} // namespace Templates