Skip to content

Go-to-def does not see through call to function template with non-dependent return type #2432

@HighCommander4

Description

@HighCommander4

In the following code:

struct Cat {
  void meow();
};

struct Unrelated {
  void meow();
};

template <typename T> Cat foo(T);

template <typename T>
void bar(T t) {
  auto cat = foo(t);
  cat.meow();
}

go-to-def on the meow token in cat.meow offers both Cat::meow and Unrelated::meow as candidates, suggesting that it's falling back to the textual heuristic.

This is a variation of the test case fixed in #897, but unlike the variation in llvm/llvm-project#124445, I don't think this case should require Sema to handle. Also, code completion handles this case fine (completion at cat.^ offers meow), suggesting that this is somehow a deficiency in the go-to-def codepath compared to code completion.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions