Skip to content

Improve auto type deduction in HeuristicResolver #124445

@HighCommander4

Description

@HighCommander4

In clangd/clangd#897 I added rudimentary support for auto type deduction to HeuristicResolver, but the accuracy could be improved further.

As an example, the implementation does not currently propagate the const when deducing const auto.

This can be seen in clangd with the following code example:

template <typename T>
struct A {
  void waldo();
  void waldo() const;
};
template <typename T>
void foo(A<T> a) {
  const auto copy = a;
  copy.waldo();
}

Go-to-definition on the waldo token in copy.waldo() offers both overloads as candidates, but it should only offer the const overload.

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:frontendLanguage frontend issues, e.g. anything involving "Sema"

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions