Skip to content

HeuristicResolver::getPointeeType discards qualifiers #123549

@HighCommander4

Description

@HighCommander4

HeuristicResolver::getPointeeType() returns a Type * rather than a QualType, which means it necessarily discards any qualifiers on the returned pointee type.

Preserving the qualifiers can be important, as seen e.g. in clangd in the following code:

template <typename T>
struct Waldo {
  void find();
  void find() const;
};

template <typename T>
struct smart_ptr {
  T* operator->();
};

template <typename T>
void foo(smart_ptr<const Waldo<T>> s) {
  s->find();
}

Go-to-definition on the find token in s->find() offers both overloads of Waldo::find() as results, when it should only offer the const overload.

Metadata

Metadata

Labels

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

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions