Index: clang-tidy/misc/UnusedUsingDeclsCheck.cpp =================================================================== --- clang-tidy/misc/UnusedUsingDeclsCheck.cpp +++ clang-tidy/misc/UnusedUsingDeclsCheck.cpp @@ -29,6 +29,12 @@ } void UnusedUsingDeclsCheck::registerMatchers(MatchFinder *Finder) { + // FIXME: make the check support C++17 or later. The check relies on the fact + // that the used declarations are visited after the "using" declaration, but + // it is not ture in C++17's template argument deduction. + if (!getLangOpts().CPlusPlus || getLangOpts().CPlusPlus17 || + getLangOpts().CPlusPlus2a) + return; Finder->addMatcher(usingDecl(isExpansionInMainFile()).bind("using"), this); auto DeclMatcher = hasDeclaration(namedDecl().bind("used")); Finder->addMatcher(loc(enumType(DeclMatcher)), this); Index: test/clang-tidy/misc-unused-using-decls-cxx17.cpp =================================================================== --- /dev/null +++ test/clang-tidy/misc-unused-using-decls-cxx17.cpp @@ -0,0 +1,15 @@ +// RUN: %check_clang_tidy %s misc-unused-using-decls %t -- -- -fno-delayed-template-parsing -std=gnu++17 + +namespace ns { +template +class KV { +public: + KV(K, V); +}; +} + +using ns::KV; + +void f() { + KV(1, 2); +}