Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Heuristic resolution does not find method in base class referenced via alias template #1657

Closed
HighCommander4 opened this issue Jun 4, 2023 · 4 comments
Assignees

Comments

@HighCommander4
Copy link

HighCommander4 commented Jun 4, 2023

In the following code:

struct Waldo {
  void find();
};

template <typename T>
using Wally = Waldo;

template <typename>
struct S : Wally<int> {
  void Foo() { this->find(); }
};

go-to-definition on the use of find() does not produce Waldo:find() as a result.

@HighCommander4 HighCommander4 self-assigned this Jun 4, 2023
@HighCommander4
Copy link
Author

HighCommander4 commented Jun 4, 2023

This needs to be fixed in the implementation of CXXRecordDecl::lookupDependentName().

I note that CXXRecordDecl::lookupDependentName() does "heuristic resolution" things much like HeuristicResolver (which uses lookupDependentName()). These two pieces of code would benefit from being "at the same level", so that e.g. the implementation of lookupDependentName() can call into other HeuristicResolver functionality.

@HighCommander4
Copy link
Author

These two pieces of code would benefit from being "at the same level", so that e.g. the implementation of lookupDependentName() can call into other HeuristicResolver functionality.

Upstreaming HeuristicResolver to live in clang/lib/, as proposed in #1662, would address this.

@HighCommander4
Copy link
Author

I've been exploring an alternative approach here for the shorter-term: reimplementing CXXRecordDecl::lookupDependentName() in HeuristicResolver so that the implementation can call into other HeuristicResolver helpers.

@HighCommander4
Copy link
Author

I've been exploring an alternative approach here for the shorter-term: reimplementing CXXRecordDecl::lookupDependentName() in HeuristicResolver so that the implementation can call into other HeuristicResolver helpers.

Proposed fix following this approach: https://reviews.llvm.org/D153248

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant