ccls icon indicating copy to clipboard operation
ccls copied to clipboard

failure to find reference to child virtual override in template class

Open Jacob-Burckhardt opened this issue 3 years ago • 0 comments

Observed behavior

When the cursor is on Child::joe definition, xref-find-references finds nothing. It should have found the call to joe in main().

template<typename T>
struct Parent {
   virtual void joe()=0;
};

template<typename T>
struct Child : public Parent<T> {
   virtual void joe() {}; // line 8
};

int main() {
   Child<int> c;
   Parent<int> &p = c;
   p.joe();
}

If modified to remove templates, then it does find the call in main():

struct Parent {
   virtual void joe()=0;
};

struct Child : public Parent {
   virtual void joe() {};
};

int main() {
   Child c;
   Parent &p = c;
   p.joe();
}

Expected behavior

It should have found the call to joe in both of the above examples.

Steps to reproduce

  1. Put the cursor on "j" in the joe declaration on line 8 in the first code example.
  2. In emacs, run M-x xref-find-references.

System information

  • ccls version (built from source, not installed from apt): Debian ccls version 0.20220729-0-g7445891
  • clang version: 11.0.1-2
  • OS: Debian GNU/Linux 11
  • Editor: Emacs 27.1
  • Language client (and version): emacs-ccls; git rev ae74a39

Jacob-Burckhardt avatar Sep 22 '22 01:09 Jacob-Burckhardt