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

Support dependent name lookup through smart pointers #322

Open
varungandhi-src opened this issue May 17, 2023 · 0 comments
Open

Support dependent name lookup through smart pointers #322

varungandhi-src opened this issue May 17, 2023 · 0 comments
Labels

Comments

@varungandhi-src
Copy link
Contributor

clangd's HeuristicResolver has some code for this. Right now, we don't handle this case.

diff --git a/test/index/functions/templates.cc b/test/index/functions/templates.cc
index 20ea11a..a1282ca 100644
--- a/test/index/functions/templates.cc
+++ b/test/index/functions/templates.cc
@@ -60,2 +60,17 @@ struct Q2: Q1<T> {
   void h() { f(); }
-};
\ No newline at end of file
+};
+
+template <typename T>
+class SmartPtr {
+  T *t;
+public:
+  T *operator->() {
+    return this->t;
+  }
+};
+
+template <typename T>
+void use_smurt_ptr(SmartPtr<Q1<T>> p) {
+  p->f();
+  p->g();
+}
\ No newline at end of file
diff --git a/test/index/functions/templates.snapshot.cc b/test/index/functions/templates.snapshot.cc
index c3fddb3..ad77484 100644
--- a/test/index/functions/templates.snapshot.cc
+++ b/test/index/functions/templates.snapshot.cc
@@ -138 +138,31 @@
   };
+  
+  template <typename T>
+//                   ^ definition local 14
+  class SmartPtr {
+//      ^^^^^^^^ definition [..] SmartPtr#
+    T *t;
+//  ^ reference local 14
+//     ^ definition [..] SmartPtr#t.
+  public:
+    T *operator->() {
+//  ^ reference local 14
+//     ^^^^^^^^ definition [..] SmartPtr#`operator->`(155dc7f103cdb9db).
+      return this->t;
+//                 ^ reference [..] SmartPtr#t.
+    }
+  };
+  
+  template <typename T>
+//                   ^ definition local 15
+  void use_smurt_ptr(SmartPtr<Q1<T>> p) {
+//     ^^^^^^^^^^^^^ definition [..] use_smurt_ptr(cde7596607162187).
+//                   ^^^^^^^^ reference [..] SmartPtr#
+//                            ^^ reference [..] Q1#
+//                               ^ reference local 15
+//                                   ^ definition local 16
+    p->f();
+//  ^ reference local 16
+    p->g();
+//  ^ reference local 16
+  }
@varungandhi-src varungandhi-src added the bug Something isn't working label May 17, 2023
@linear linear bot closed this as not planned Won't fix, can't repro, duplicate, stale Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant