Skip to content

Commit fb68c3c

Browse files
committed
fix false negative with variable templates: take two
1 parent b7a23d9 commit fb68c3c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

clang-tools-extra/clang-tidy/readability/RedundantTypenameCheck.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ void RedundantTypenameCheck::registerMatchers(MatchFinder *Finder) {
3232
hasParent(typedefNameDecl()), hasParent(templateTypeParmDecl()),
3333
hasParent(nonTypeTemplateParmDecl()), hasParent(cxxNamedCastExpr()),
3434
hasParent(cxxNewExpr()), hasParent(friendDecl()), hasParent(fieldDecl()),
35-
hasParent(varDecl(unless(hasDeclContext(functionDecl())))),
35+
hasParent(varDecl(
36+
hasDeclContext(anyOf(namespaceDecl(), translationUnitDecl())))),
3637
hasParent(parmVarDecl(hasParent(expr(requiresExpr())))),
3738
hasParent(parmVarDecl(hasParent(typeLoc(hasParent(
3839
namedDecl(anyOf(cxxMethodDecl(), hasParent(friendDecl()),

0 commit comments

Comments
 (0)