Index: clang-tidy/readability/IdentifierNamingCheck.cpp =================================================================== --- clang-tidy/readability/IdentifierNamingCheck.cpp +++ clang-tidy/readability/IdentifierNamingCheck.cpp @@ -663,8 +663,9 @@ if (const auto &Ref = Loc->getAs()) { - addUsage(NamingCheckFailures, Ref.getTypePtr()->getAsTagDecl(), - Loc->getSourceRange()); + if (const auto *Decl = Ref.getTypePtr()->getAsTagDecl()) { + addUsage(NamingCheckFailures, Decl, Loc->getSourceRange()); + } return; } } Index: test/clang-tidy/readability-identifier-naming.cpp =================================================================== --- test/clang-tidy/readability-identifier-naming.cpp +++ test/clang-tidy/readability-identifier-naming.cpp @@ -344,3 +344,7 @@ // CHECK-FIXES: {{^}}void MY_TEST_MACRO(function) {} } } + +template struct a { + typename t_t::template b<> c; +};