diff --git a/clang-tools-extra/clangd/HeuristicResolver.cpp b/clang-tools-extra/clangd/HeuristicResolver.cpp --- a/clang-tools-extra/clangd/HeuristicResolver.cpp +++ b/clang-tools-extra/clangd/HeuristicResolver.cpp @@ -35,6 +35,9 @@ CXXRecordDecl *resolveTypeToRecordDecl(const Type *T) { assert(T); + // Unwrap type sugar such as type aliases. + T = T->getCanonicalTypeInternal().getTypePtr(); + if (const auto *RT = T->getAs()) return dyn_cast(RT->getDecl()); diff --git a/clang-tools-extra/clangd/unittests/FindTargetTests.cpp b/clang-tools-extra/clangd/unittests/FindTargetTests.cpp --- a/clang-tools-extra/clangd/unittests/FindTargetTests.cpp +++ b/clang-tools-extra/clangd/unittests/FindTargetTests.cpp @@ -863,6 +863,20 @@ )cpp"; EXPECT_DECLS("CXXDependentScopeMemberExpr", "template T convert() const"); + + Code = R"cpp( + template + struct Waldo { + void find(); + }; + template + using Wally = Waldo; + template + void foo(Wally w) { + w.[[find]](); + } + )cpp"; + EXPECT_DECLS("CXXDependentScopeMemberExpr", "void find()"); } TEST_F(TargetDeclTest, DependentTypes) {