Index: clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp @@ -656,15 +656,16 @@ SourceRange Range(Ref.getTemplateNameLoc(), Ref.getTemplateNameLoc()); if (const auto *ClassDecl = dyn_cast(Decl)) { - addUsage(NamingCheckFailures, ClassDecl->getTemplatedDecl(), Range); + if (const auto *TemplDecl = ClassDecl->getTemplatedDecl()) + addUsage(NamingCheckFailures, TemplDecl, Range); return; } } 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: clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming.cpp =================================================================== --- clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming.cpp +++ clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming.cpp @@ -344,3 +344,9 @@ // CHECK-FIXES: {{^}}void MY_TEST_MACRO(function) {} } } + +template struct a { + typename t_t::template b<> c; +}; + +template