Index: include/clang/AST/RecursiveASTVisitor.h =================================================================== --- include/clang/AST/RecursiveASTVisitor.h +++ include/clang/AST/RecursiveASTVisitor.h @@ -1324,6 +1324,8 @@ DEF_TRAVERSE_DECL(ExternCContextDecl, {}) DEF_TRAVERSE_DECL(NamespaceAliasDecl, { + TRY_TO(TraverseNestedNameSpecifierLoc(D->getQualifierLoc())); + // We shouldn't traverse an aliased namespace, since it will be // defined (and, therefore, traversed) somewhere else. // Index: unittests/ASTMatchers/ASTMatchersTest.cpp =================================================================== --- unittests/ASTMatchers/ASTMatchersTest.cpp +++ unittests/ASTMatchers/ASTMatchersTest.cpp @@ -4487,6 +4487,8 @@ nestedNameSpecifier())); EXPECT_TRUE(matches("struct A { void f(); }; void A::f() {}", nestedNameSpecifier())); + EXPECT_TRUE(matches("namespace a { namespace b {} } namespace ab = a::b;", + nestedNameSpecifier())); EXPECT_TRUE(matches( "struct A { static void f() {} }; void g() { A::f(); }",