diff --git a/clang-tools-extra/clangd/refactor/tweaks/ExpandAutoType.cpp b/clang-tools-extra/clangd/refactor/tweaks/ExpandAutoType.cpp --- a/clang-tools-extra/clangd/refactor/tweaks/ExpandAutoType.cpp +++ b/clang-tools-extra/clangd/refactor/tweaks/ExpandAutoType.cpp @@ -61,7 +61,9 @@ if (auto *Node = Inputs.ASTSelection.commonAncestor()) { if (auto *TypeNode = Node->ASTNode.get()) { if (const AutoTypeLoc Result = TypeNode->getAs()) { - CachedLocation = Result; + // Code in apply() does handle 'decltype(auto)' yet. + if (!Result.getTypePtr()->isDecltypeAuto()) + CachedLocation = Result; } } } diff --git a/clang-tools-extra/clangd/unittests/TweakTests.cpp b/clang-tools-extra/clangd/unittests/TweakTests.cpp --- a/clang-tools-extra/clangd/unittests/TweakTests.cpp +++ b/clang-tools-extra/clangd/unittests/TweakTests.cpp @@ -528,6 +528,8 @@ // replace array types EXPECT_EQ(apply(R"cpp(au^to x = "test")cpp"), R"cpp(const char * x = "test")cpp"); + + EXPECT_UNAVAILABLE("dec^ltype(au^to) x = 10;"); } TWEAK_TEST(ExtractFunction);